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

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

                    Circuit construction for execution of conditional statements using least significant bitHow are two different registers being used as “control”?How exactly is the stated composite state of the two registers being produced using the $R_zz$ controlled rotations?Efficiently performing controlled rotations in HHLWould this quantum algorithm implementation work?How to prepare a superposed states of odd integers from $1$ to $sqrtN$?Why is this implementation of the order finding algorithm not working?Circuit construction for Hamiltonian simulationHow can I invert the least significant bit of a certain term of a superposed state?Implementing an oracleImplementing a controlled sum operation

                    Magento 2 “No Payment Methods” in Admin New OrderHow to integrate Paypal Express Checkout with the Magento APIMagento 1.5 - Sales > Order > edit order and shipping methods disappearAuto Invoice Check/Money Order Payment methodAdd more simple payment methods?Shipping methods not showingWhat should I do to change payment methods if changing the configuration has no effects?1.9 - No Payment Methods showing upMy Payment Methods not Showing for downloadable/virtual product when checkout?Magento2 API to access internal payment methodHow to call an existing payment methods in the registration form?