Returning strings showing all vertices from all polygons in shapefile using ArcPy?Concatenating list of strings using ArcPy?Use arcpy.da.searchcursor to select rows to dissolveConverting Vertices of Polylines and Polygons to Points and Maintain AttributesCheck if a polygon is at one elevationSelecting all polygons where neighbor vertex points are below distance threshold in ArcPy?Cutting polygon using line - cutter, cut() - using ArcPy?ArcPy Insert cursor losing vertices when writing Polygon features?Exporting jpeg around polygon boundary using Python?Stratified random point sampling in PythonUsing ArcPy to ListFields inside SearchCursor?Switching from Nested Search Cursors to Dictionaries

How do I generate distribution of positive numbers only with min, max and mean?

3D Statue Park: U shapes

What exactly makes a General Products hull nearly indestructible?

Grid/table with lots of buttons

Trapped in an ocean Temple in Minecraft?

Character is called by their first initial. How do I write it?

Replacing tongue and groove floorboards: but can't find a match

Timing/Stack question about abilities triggered during combat

Why is a dedicated QA team member necessary?

Where to place an artificial gland in the human body?

Why are so many countries still in the Commonwealth?

Is dd if=/dev/urandom of=/dev/mem safe?

How did C64 games handle music during gameplay?

How may I concisely assign different values to a variable, depending on another variable?

What are the exact meanings of roll, pitch and yaw?

kids pooling money for Lego League and taxes

Reduce column width of table while also aligning values at decimal point

How do I run a game when my PCs have different approaches to combat?

Area of parallelogram = Area of square. Shear transform

Are there any examples of technologies have been lost over time?

Commercial jet accompanied by small plane near Seattle

Why are off grid solar setups only 12, 24, 48 VDC?

Strange Cron Job takes up 100% of CPU Ubuntu 18 LTS Server

Memory capability and powers of 2



Returning strings showing all vertices from all polygons in shapefile using ArcPy?


Concatenating list of strings using ArcPy?Use arcpy.da.searchcursor to select rows to dissolveConverting Vertices of Polylines and Polygons to Points and Maintain AttributesCheck if a polygon is at one elevationSelecting all polygons where neighbor vertex points are below distance threshold in ArcPy?Cutting polygon using line - cutter, cut() - using ArcPy?ArcPy Insert cursor losing vertices when writing Polygon features?Exporting jpeg around polygon boundary using Python?Stratified random point sampling in PythonUsing ArcPy to ListFields inside SearchCursor?Switching from Nested Search Cursors to Dictionaries






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in this example)



import arcpy
fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'

myList = []

with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
for row in cursor:
array1=row[1].getPart()
for vertice in range(row[1].pointCount):
pnt=array1.getObject(0).getObject(vertice)
print row[0],pnt.X,pnt.Y
myList.append(str(pnt.X) + " " + str(pnt.Y))

print ", ".join(myList)


This is the result



1 151.513429431 -33.568900991
1 151.313554706 -34.011480738
1 150.928082023 -33.975788823
1 150.906666874 -34.27560091
1 150.506917425 -34.211355462
1 150.692515384 -33.51893231
1 151.513429431 -33.568900991
2 151.72520146 -32.500522999
2 152.082120611 -33.242914833
2 151.196961117 -33.100147173
2 151.72520146 -32.500522999
151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991, 151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


But what I want is separate strings for each polygon in the shapefile



151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991
151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


How would you do this?










share|improve this question






























    2















    I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in this example)



    import arcpy
    fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'

    myList = []

    with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
    for row in cursor:
    array1=row[1].getPart()
    for vertice in range(row[1].pointCount):
    pnt=array1.getObject(0).getObject(vertice)
    print row[0],pnt.X,pnt.Y
    myList.append(str(pnt.X) + " " + str(pnt.Y))

    print ", ".join(myList)


    This is the result



    1 151.513429431 -33.568900991
    1 151.313554706 -34.011480738
    1 150.928082023 -33.975788823
    1 150.906666874 -34.27560091
    1 150.506917425 -34.211355462
    1 150.692515384 -33.51893231
    1 151.513429431 -33.568900991
    2 151.72520146 -32.500522999
    2 152.082120611 -33.242914833
    2 151.196961117 -33.100147173
    2 151.72520146 -32.500522999
    151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991, 151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


    But what I want is separate strings for each polygon in the shapefile



    151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991
    151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


    How would you do this?










    share|improve this question


























      2












      2








      2








      I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in this example)



      import arcpy
      fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'

      myList = []

      with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
      for row in cursor:
      array1=row[1].getPart()
      for vertice in range(row[1].pointCount):
      pnt=array1.getObject(0).getObject(vertice)
      print row[0],pnt.X,pnt.Y
      myList.append(str(pnt.X) + " " + str(pnt.Y))

      print ", ".join(myList)


      This is the result



      1 151.513429431 -33.568900991
      1 151.313554706 -34.011480738
      1 150.928082023 -33.975788823
      1 150.906666874 -34.27560091
      1 150.506917425 -34.211355462
      1 150.692515384 -33.51893231
      1 151.513429431 -33.568900991
      2 151.72520146 -32.500522999
      2 152.082120611 -33.242914833
      2 151.196961117 -33.100147173
      2 151.72520146 -32.500522999
      151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991, 151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


      But what I want is separate strings for each polygon in the shapefile



      151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991
      151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


      How would you do this?










      share|improve this question
















      I want to have a string showing all vertices from all polygons in a shapefile. In my example below my code lists all vertices and the first column shows the polygon they are part of (I only have 2 in this example)



      import arcpy
      fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'

      myList = []

      with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
      for row in cursor:
      array1=row[1].getPart()
      for vertice in range(row[1].pointCount):
      pnt=array1.getObject(0).getObject(vertice)
      print row[0],pnt.X,pnt.Y
      myList.append(str(pnt.X) + " " + str(pnt.Y))

      print ", ".join(myList)


      This is the result



      1 151.513429431 -33.568900991
      1 151.313554706 -34.011480738
      1 150.928082023 -33.975788823
      1 150.906666874 -34.27560091
      1 150.506917425 -34.211355462
      1 150.692515384 -33.51893231
      1 151.513429431 -33.568900991
      2 151.72520146 -32.500522999
      2 152.082120611 -33.242914833
      2 151.196961117 -33.100147173
      2 151.72520146 -32.500522999
      151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991, 151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


      But what I want is separate strings for each polygon in the shapefile



      151.513429431 -33.568900991, 151.313554706 -34.011480738, 150.928082023 -33.975788823, 150.906666874 -34.27560091, 150.506917425 -34.211355462, 150.692515384 -33.51893231, 151.513429431 -33.568900991
      151.72520146 -32.500522999, 152.082120611 -33.242914833, 151.196961117 -33.100147173, 151.72520146 -32.500522999


      How would you do this?







      arcpy polygon vertices list string






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 16 at 19:19









      PolyGeo

      54.7k17 gold badges86 silver badges258 bronze badges




      54.7k17 gold badges86 silver badges258 bronze badges










      asked Jul 16 at 13:31









      GiacomoGiacomo

      699 bronze badges




      699 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          5














          You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex.



          import arcpy
          fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'



          with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
          for row in cursor:
          myList = []
          array1=row[1].getPart()
          for vertice in range(row[1].pointCount):
          pnt=array1.getObject(0).getObject(vertice)
          # print row[0],pnt.X,pnt.Y
          myList.append(str(pnt.X) + " " + str(pnt.Y))
          print row[0], ", ".join(myList)









          share|improve this answer



























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "79"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f328917%2freturning-strings-showing-all-vertices-from-all-polygons-in-shapefile-using-arcp%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            5














            You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex.



            import arcpy
            fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'



            with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
            for row in cursor:
            myList = []
            array1=row[1].getPart()
            for vertice in range(row[1].pointCount):
            pnt=array1.getObject(0).getObject(vertice)
            # print row[0],pnt.X,pnt.Y
            myList.append(str(pnt.X) + " " + str(pnt.Y))
            print row[0], ", ".join(myList)









            share|improve this answer





























              5














              You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex.



              import arcpy
              fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'



              with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
              for row in cursor:
              myList = []
              array1=row[1].getPart()
              for vertice in range(row[1].pointCount):
              pnt=array1.getObject(0).getObject(vertice)
              # print row[0],pnt.X,pnt.Y
              myList.append(str(pnt.X) + " " + str(pnt.Y))
              print row[0], ", ".join(myList)









              share|improve this answer



























                5












                5








                5







                You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex.



                import arcpy
                fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'



                with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
                for row in cursor:
                myList = []
                array1=row[1].getPart()
                for vertice in range(row[1].pointCount):
                pnt=array1.getObject(0).getObject(vertice)
                # print row[0],pnt.X,pnt.Y
                myList.append(str(pnt.X) + " " + str(pnt.Y))
                print row[0], ", ".join(myList)









                share|improve this answer















                You have the general idea in place already -- just move your print of the list into the loop, and remove the print for each vertex.



                import arcpy
                fc=r'D:GIS DataTOOLSEV calc in PythonData.gdbPolyWGS84'



                with arcpy.da.SearchCursor(fc,['OID@','SHAPE@']) as cursor:
                for row in cursor:
                myList = []
                array1=row[1].getPart()
                for vertice in range(row[1].pointCount):
                pnt=array1.getObject(0).getObject(vertice)
                # print row[0],pnt.X,pnt.Y
                myList.append(str(pnt.X) + " " + str(pnt.Y))
                print row[0], ", ".join(myList)










                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jul 16 at 13:47

























                answered Jul 16 at 13:36









                smillersmiller

                2,9235 silver badges17 bronze badges




                2,9235 silver badges17 bronze badges



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f328917%2freturning-strings-showing-all-vertices-from-all-polygons-in-shapefile-using-arcp%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

                    Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

                    Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form