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.

Is there any way to convert polygons that do not have coordinates in the attribute table to a txt file with coordinates. I will be using the txt file in a different software (not ArcGIS), so I need the txt file with polygon coordinates.

Hope someone can help me. Thank you in advance.

Lina

share|improve this question
    
For getting better answers, could you add a couple of details: Do you wish to get coordinates of polygon vertices or polygon centroids? Are your polygons in a shapefile? Which version of ArcGIS are you using? And do you wish to perform this in ArcGIS only or you don't mind to install some open-source software, or to program a little? –  nadya Nov 13 '12 at 2:06
add comment

2 Answers 2

First, welcome to the site!

The easiest way would be to use ogr2ogr from the GDAL package (an open source spatial conversions library) and convert your feature class to a text format such as GeoJSON (and the specification). I'd strongly recommend this method if possible, especially if you don't have much programming experience.

If you don't have access to this (can't install it, or your data is in SDE or another format which you can't access with ogr2ogr) then it's possible using the arcpy Python module to extract feature geometries using a SearchCursor (I'm assuming you're using ArcGIS 10, but this would also work with 10.1).

Depending on your polygons you have two potential methods in ArcGIS:

  • If you have simple polygons (no multipart, no holes) you can use geom.geo_interface to extract the vertices as a geojson string. For example:
shapefieldname = arcpy.Describe(dataset).ShapeFieldName

for row in arcpy.SearchCursor(dataset):
    print row.getValue(shapefieldname).__geo_interface__
  • Otherwise if the geometry is more complex take a look at this sample script from the ESRI help on Reading Geometries.
share|improve this answer
2  
+1 Very cool, that's a new one to me. –  Chad Cooper Nov 12 '12 at 21:54
add comment

Assuming you want to use ArcGIS to convert the polygon features to a table, which will then be be used in different software, try the following:

  1. Open your feature attribute table
  2. Add Field > Type Double > Label "x"
  3. Right click on the new field name "x" and select "Calculate Geometry"
  4. Choose Property: "X coordinate of centroid" > OK

  5. Repeat steps 2 - 4 for the Y coordinates

enter image description here

Please note that these coordinates represent the centroid of the polygon features (i.e. the geometric center of the polygon)

To export the table:

  1. In the attribute table, select "Export..."
  2. Choose the file tab which opens a new window, select Save as Type: "Text File"
  3. Save

enter image description here

share|improve this answer
add comment

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.