Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a point shapefile with over 3000 points that are updated frequently, when they are updated they need to have their lat/longs changed which is entered into the attribute table.

When the lat/longs are updated in the attribute table I notice that the feature does not actually change its position in correlation to the new lat/long entered in the attribute table.

Is there a way to make this happen in ArcView with out having to re-export the attribute table out as a dbf, add it to the map then display xy data?

share|improve this question
up vote 11 down vote accepted

It sounds like you're updating some attributes of your features instead of updating the actual geometry. You can make changes to a feature's geometry using python but it's a couple extra lines of code. Check out this example:

import arcpy
shapeName = arcpy.Describe('c:/path/to/shp/update_geom.shp').shapeFieldName
rows = arcpy.UpdateCursor(r'c:/path/to/shp/update_geom.shp')
row = rows.next() # just one row...you could iterate through all rows
pnt = arcpy.Point(row.getValue(shapeName).getPart(0).X + 0.5, row.getValue(shapeName).getPart(0).Y + 0.5)
row.setValue(shapeName, pnt)
rows.updateRow(row)
del rows

That only updates one row but demonstrates how to update a point feature's geometry.

**Added code that loops over all rows.

import arcpy
shapeName = arcpy.Describe('c:/path/to/shp/update_geom.shp').shapeFieldName
rows = arcpy.UpdateCursor(r'c:/path/to/shp/update_geom.shp')
for row in rows:
  row = rows.next()
  pnt = arcpy.Point(row.getValue(shapeName).getPart(0).X + 0.5, row.getValue(shapeName).getPart(0).Y + 0.5)
  row.setValue(shapeName, pnt)
  rows.updateRow(row)
del rows
share|improve this answer

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.