<?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 Create a Multi polygons feature issue in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413277#M9913</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to create a multi polygons feature into a hosted feature layer and I am stuck! I am creating the array of rings on the fly and trying to replay the array of rings from my geometry template. When I print the information, everything looks good, but when I try to create a the feature, my "array" of rings is really a "string" of rings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code and the issue I am facing&lt;/P&gt;&lt;P&gt;Any help would be much appreciated&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;geomList = []
geoArray = []
for d in search_SAhistcountTVMAXFeat:
    if d.attributes['LandRecordsIDCount']&amp;gt;1:
        print(d)
        #Select at records with that specific LandRecordID
        fExpression = "LandRecordsID='" + d.attributes['LandRecordsID'] +"'"
        print(fExpression)
        SLHFLcount = LandHFL.query(where=fExpression )
        feat_list = SLHFLcount.features

        ### NEED TO EXTRACT SINGLE PART FOR EACH POLYGONS
        strPoly =''
        strPoly = '['
        print("RAW Geometry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        for f in feat_list:
            print(f.geometry['rings']) 
            print("")
            strPoly = strPoly+str(f.geometry['rings'])[1:-1]+','
        strPoly = strPoly[:-1]
        strPoly= strPoly+']'
        print("All Geometry as String~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        print(strPoly)
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        print("          ")

        #single part template
        drtest = {'rings': [[[-10478969.9507, 5105644.4034], [-10477947.6054, 5105639.626], [-10477952.3827, 5104555.1757], [-10478998.6146, 5104559.953], [-10479017.7238, 5105333.8779], [-10478979.5053, 5105338.6552], [-10478969.9507, 5105644.4034]]],'spatialReference': {'wkid': 102100,'latestWkid': 3857}}
        print("Rings from template")
        print(drtest["rings"])
        print(" ")
        print("after update")
        drtest["rings"] = strPoly   
        print(drtest["rings"])

        print("Creating Template-------------------------")        
        features_to_be_added = []
        template_hostedFeature = deepcopy(SLHFLcount.features[0])
        template_hostedFeature

        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        drShape = drtest  #geom_union_b
        print(drShape)
        new_feature = deepcopy(template_hostedFeature)
        print("")
        # assign the updated values
        new_feature.geometry = drShape    #output_geometry[0]
        new_feature.attributes['LandRecordsID'] = d.attributes['LandRecordsID']
        #new_feature.attributes['Property'] = ''
        print("Final new feature-------------------------")
        print(new_feature)&lt;/LI-CODE&gt;&lt;P&gt;results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DominicRoberge2_0-1713732557513.png" style="width: 984px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/101661i7D0107C60B003ADB/image-dimensions/984x388?v=v2" width="984" height="388" role="button" title="DominicRoberge2_0-1713732557513.png" alt="DominicRoberge2_0-1713732557513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Apr 2024 20:50:01 GMT</pubDate>
    <dc:creator>DominicRobergeIADOT</dc:creator>
    <dc:date>2024-04-21T20:50:01Z</dc:date>
    <item>
      <title>Create a Multi polygons feature issue</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413277#M9913</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am trying to create a multi polygons feature into a hosted feature layer and I am stuck! I am creating the array of rings on the fly and trying to replay the array of rings from my geometry template. When I print the information, everything looks good, but when I try to create a the feature, my "array" of rings is really a "string" of rings.&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is the code and the issue I am facing&lt;/P&gt;&lt;P&gt;Any help would be much appreciated&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;LI-CODE lang="python"&gt;geomList = []
geoArray = []
for d in search_SAhistcountTVMAXFeat:
    if d.attributes['LandRecordsIDCount']&amp;gt;1:
        print(d)
        #Select at records with that specific LandRecordID
        fExpression = "LandRecordsID='" + d.attributes['LandRecordsID'] +"'"
        print(fExpression)
        SLHFLcount = LandHFL.query(where=fExpression )
        feat_list = SLHFLcount.features

        ### NEED TO EXTRACT SINGLE PART FOR EACH POLYGONS
        strPoly =''
        strPoly = '['
        print("RAW Geometry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        for f in feat_list:
            print(f.geometry['rings']) 
            print("")
            strPoly = strPoly+str(f.geometry['rings'])[1:-1]+','
        strPoly = strPoly[:-1]
        strPoly= strPoly+']'
        print("All Geometry as String~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        print(strPoly)
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        print("          ")

        #single part template
        drtest = {'rings': [[[-10478969.9507, 5105644.4034], [-10477947.6054, 5105639.626], [-10477952.3827, 5104555.1757], [-10478998.6146, 5104559.953], [-10479017.7238, 5105333.8779], [-10478979.5053, 5105338.6552], [-10478969.9507, 5105644.4034]]],'spatialReference': {'wkid': 102100,'latestWkid': 3857}}
        print("Rings from template")
        print(drtest["rings"])
        print(" ")
        print("after update")
        drtest["rings"] = strPoly   
        print(drtest["rings"])

        print("Creating Template-------------------------")        
        features_to_be_added = []
        template_hostedFeature = deepcopy(SLHFLcount.features[0])
        template_hostedFeature

        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
        drShape = drtest  #geom_union_b
        print(drShape)
        new_feature = deepcopy(template_hostedFeature)
        print("")
        # assign the updated values
        new_feature.geometry = drShape    #output_geometry[0]
        new_feature.attributes['LandRecordsID'] = d.attributes['LandRecordsID']
        #new_feature.attributes['Property'] = ''
        print("Final new feature-------------------------")
        print(new_feature)&lt;/LI-CODE&gt;&lt;P&gt;results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DominicRoberge2_0-1713732557513.png" style="width: 984px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/101661i7D0107C60B003ADB/image-dimensions/984x388?v=v2" width="984" height="388" role="button" title="DominicRoberge2_0-1713732557513.png" alt="DominicRoberge2_0-1713732557513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Apr 2024 20:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413277#M9913</guid>
      <dc:creator>DominicRobergeIADOT</dc:creator>
      <dc:date>2024-04-21T20:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Multi polygons feature issue</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413364#M9915</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/366436"&gt;@DominicRobergeIADOT&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are converting the geometry to string.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;strPoly = strPoly+str(f.geometry['rings'])[1:-1]+','&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when you need to keep it as the nested lists and manipulate the lists instead to create your new geometry..&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 07:57:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413364#M9915</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-04-22T07:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Create a Multi polygons feature issue</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413489#M9916</link>
      <description>&lt;P&gt;I had been looking at this issue for too long &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;got it&lt;/P&gt;&lt;P&gt;geoArray.append(f.geometry['rings'][0])&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Mon, 22 Apr 2024 13:23:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/create-a-multi-polygons-feature-issue/m-p/1413489#M9916</guid>
      <dc:creator>DominicRobergeIADOT</dc:creator>
      <dc:date>2024-04-22T13:23:51Z</dc:date>
    </item>
  </channel>
</rss>

