I need to extract data from a shapefile using ArcGIS for Desktop 10.2.

The data needed is all the vertices (x,y coordinates in geographic WGS 1984) that construct the polygon below.

I need to get all these vertices as an Excel spreadsheet.

enter image description here

  • 3
    Exporting a Table to Excel became easy at ArcGIS 10.2 for Desktop when the Excel Tools were added, but from your question it is unclear what Latitude and Longitude values you want to write: centroid?, extent?, vertices? Can you edit your Question to provide more precise details of the workflow you are wanting to perform, please? – PolyGeo Mar 26 '14 at 5:52
  • i need to extract all the vertices. – Enas Ali Mar 26 '14 at 8:34
  • 1
    Please edit the question to clearly state what you need. – Vince Mar 26 '14 at 9:17
  • Please use the edit button beneath your Question to revise it with this and additional details like the format you are wanting to see in the exported Excel worksheet i.e. one row per vertex or ? Are you planning to do this on one selected polygon or ? – PolyGeo Mar 26 '14 at 9:18

One way would be to convert the polygon into series of points (using feature vertices to points) and save it as a new shapefile.In the attribute table you can 'add' a new lat and long 'field' and populate it with the lat/long values using 'calculate geometry' option. The attribute table information is available in the .dbf file associated with the shapefile. You can open it in excel and save it in your favorite format. Or you can directly export it to excel using Table to excel as you have ArcGIS 10.2.

| improve this answer | |
  • i make all you say ..but i need to extract all points (coordinates )not only one . – Enas Ali Mar 26 '14 at 8:33
  • 1
    +1 @Arihant You may want to include some links and/or graphics to explain this in slightly more detail. To me it would seem to provide a solution to what I am starting to understand of the requirements in this Question – PolyGeo Mar 26 '14 at 10:20
  • i plot a red line for the vertices i needed ..i need to extract these x,y coordinates to excel sheet .. – Enas Ali Mar 26 '14 at 10:45
  • @Arihant has a great solution. Keep in mind that the tool he suggests requires an Advanced license: Feature Vertices To Points (Data Management). If you are able to run this tool, Calculate Geometry on your new feature class for two new fields (in your case, custom X & Y fields). Then export the attribute table as required. – Adam Mar 26 '14 at 13:14

This might help you out:

fc = "C:/myfc.shp"
csv = open("C:/Vertices.csv", "w")

with arcpy.da.SearchCursor(fc, ("SHAPE@")) as cursor:
    for row in cursor:
        for part in row[0]:
            for pnt in part:
                csv.write("{0},{1}\n".format(pnt.X, pnt.Y))


If you have more than one polygon you would want to include the ObjectID field in the cursor to distinguish what is what.

| improve this answer | |
  • What did you end up doing? – ianbroad Mar 26 '14 at 14:24
  • these data that i get it ..i will include it when i generating heat maps in order to control the drowing only inside borders of iraq not outside. – Enas Ali Mar 26 '14 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.