Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

share|improve this question
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 at 5:52
    
i need to extract all the vertices. –  user3423232 Mar 26 at 8:34
1  
Please edit the question to clearly state what you need. –  Vince Mar 26 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 at 9:18

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
i make all you say ..but i need to extract all points (coordinates )not only one . –  user3423232 Mar 26 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 at 10:20
    
i plot a red line for the vertices i needed ..i need to extract these x,y coordinates to excel sheet .. –  user3423232 Mar 26 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. –  amarinel Mar 26 at 13:14
    
Thanks to all for help me. –  user3423232 Mar 26 at 14:23

This might help you out:

fc = "C:/myfc.shp"
csv = open("C:/Vertices.csv", "w")
csv.write("X,Y\n")

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))

csv.close()

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

share|improve this answer
    
thank you very much ..I get the solution . –  user3423232 Mar 26 at 14:23
    
What did you end up doing? –  ian Mar 26 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. –  user3423232 Mar 26 at 14:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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