<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 'geometry' parameter is invalid when creating replica in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804366#M2221</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for reporting this.&amp;nbsp;We've included the fix and it will be part of the next update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Mar 2018 07:44:32 GMT</pubDate>
    <dc:creator>RohitSingh2</dc:creator>
    <dc:date>2018-03-16T07:44:32Z</dc:date>
    <item>
      <title>'geometry' parameter is invalid when creating replica</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804365#M2220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE style="color: #000000; background-color: transparent; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #ff0000; font-size: 22px;"&gt;&lt;STRONG&gt;Unable to create replica. Please check your parameters. 'geometry' parameter is invalid&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;You are guaranteed to see this error when using geometry filter as parameter to&amp;nbsp;create a replica in the latest ArcGIS API for Python (V1.4.0)!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the signature of function FeatureLayerCollection.replicas.create, it states geometry_filter parameter as the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="color: #000000; background-color: #f7f7f7; border: 1px solid #cccccc; font-size: 14px; margin: 0px 0px 9px; padding: 0.4em;"&gt;geometry_filter - spatial filter from arcgis.geometry.filters module to filter results by a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; spatial relationship with another geometry&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following this instruction, I constructed an filter object:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;flc=gis.content.get('1bedbababababababab5')&lt;BR /&gt; aa=flc.layers[0]&lt;BR /&gt; fset=aa.query()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;geom=None&lt;BR /&gt; f=None&lt;BR /&gt; geo_filter=None&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;count=len(fset.features)&lt;BR /&gt; if count&amp;gt;0:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;f=fset.features[0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;geom=f.geometry&lt;BR /&gt; if geom is not None:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;geo=Polygon(geom)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;geo_filter=arcgis.geometry.filters.contains(geo,'102100')&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;fs = FeatureLayerCollection(url, gis)&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;result = fs.replicas.create(replica_name='test', layers='0,1,3,4,6,8,10,12,13,15', layer_queries=layerQs,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;STRONG&gt; geometry_filter=geo_filter&lt;/STRONG&gt;, &lt;BR /&gt; replica_sr='102100', &lt;BR /&gt; transport_type="esriTransportTypeUrl", &lt;BR /&gt; return_attachments=returnAttach, &lt;BR /&gt; return_attachments_databy_url=returnAttachbyURL, &lt;BR /&gt; asynchronous=False, &lt;BR /&gt; attachments_sync_direction=attachSyncDirect, &lt;BR /&gt; sync_model="none", &lt;BR /&gt; data_format=format, &lt;BR /&gt; replica_options=None, &lt;BR /&gt; wait=False, &lt;BR /&gt; out_path=r'C:\Temp\fs_replicas', &lt;BR /&gt; sync_direction='bidirectional', &lt;BR /&gt; target_type="client")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;geo_filter will crash the function, 100%.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Why?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;json representation of geo_filter object was posted to the following endpoint (REST Resource)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2F" rel="nofollow" target="_blank"&gt;http://&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&amp;lt;featureservice-url&amp;gt;/createReplica&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This resource only accepts geometry, geometryType,inSR, but not geometry.filters format. click the following link to find the acceptable parameters createReplica&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://developers.arcgis.com/rest/services-reference/create-replica.htm" title="https://developers.arcgis.com/rest/services-reference/create-replica.htm"&gt;Create Replica—ArcGIS REST API: Services Directory | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The difference between the acceptable geometry and&amp;nbsp;&lt;SPAN&gt;geometry.filters? just give you an example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;geometry:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px;"&gt;&lt;STRONG&gt;{'rings': [[[14884284.6024463, -3776313.01482297], [15552038.4815454, -3766529.07520247], [15657215.8324658, -4475864.69768871], [15192478.700492, -4307091.73923509], [14884284.6024463, -3776313.01482297]]]}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;geometry.filters.contains:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;STRONG&gt;{'geometry': {"rings": [[[14884284.6024463, -3776313.01482297], [15552038.4815454, -3766529.07520247], [15657215.8324658, -4475864.69768871], [15192478.700492, -4307091.73923509], [14884284.6024463, -3776313.01482297]]]}, 'geometryType': 'esriGeometryPolygon', 'spatialRel': 'esriSpatialRelContains'}&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 30px;"&gt;&lt;STRONG&gt;How to fix it?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Pretty simple, only 3 lines of code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;in the &lt;STRONG&gt;layer.py&lt;/STRONG&gt; under the following folder:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;STRONG&gt;C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis-1.3.0-py3.6.egg\arcgis\features&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;STRONG&gt;line 1453 (v1.3.0) / line1467 (v1.4.0):&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;if geometry_filter is not None and \&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;isinstance(geometry_filter, dict):&lt;BR /&gt; ##comment out the original code and get geometry, geometryType and inSR seperately!&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;&lt;SPAN style="background-color: #f6f6f6;"&gt;##params['geometry'] = geometry_filter&lt;/SPAN&gt;&lt;BR /&gt; params['geometry'] = geometry_filter['geometry']&lt;BR /&gt; params['geometryType'] = geometry_filter['geometryType']&lt;BR /&gt; params['inSR'] = geometry_filter['inSR']&lt;BR /&gt; #params.update(geometry_filter)&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 22px;"&gt;&lt;STRONG&gt;Conclusion:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;It seems just an oversight in the API development, and it won't take much to fix.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;But, this bug should not slip through the QA process, because creating replica is such an important function, and using geometry to clip data and create a replica is such a common GIS practice. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;I guess the bug has been around for quite a while, it's already v1.40 !&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 15px;"&gt;Please fix it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;This puzzled me for the whole afternoon, I hope&amp;nbsp;others can avoid it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/45514"&gt;Atma Mani&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/2049"&gt;John Yaist&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 02:28:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804365#M2220</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-03-16T02:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: 'geometry' parameter is invalid when creating replica</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804366#M2221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for reporting this.&amp;nbsp;We've included the fix and it will be part of the next update.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 07:44:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804366#M2221</guid>
      <dc:creator>RohitSingh2</dc:creator>
      <dc:date>2018-03-16T07:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: 'geometry' parameter is invalid when creating replica</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804367#M2222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rohit,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for confirming it.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Simo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Mar 2018 08:41:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/geometry-parameter-is-invalid-when-creating/m-p/804367#M2222</guid>
      <dc:creator>simoxu</dc:creator>
      <dc:date>2018-03-16T08:41:57Z</dc:date>
    </item>
  </channel>
</rss>

