Select to view content in your preferred language

Spatial Reference question

2863
2
Jump to solution
11-28-2012 09:57 AM
by Anonymous User
Not applicable
Original User: luke.kaim

Hi Everyone,

I am using the search cursor. I want to change the spatial reference on the fly. I believe this can be done with spatial_reference.


the input shapefile is in UTM 19N. I want the extents to be in DD. I know I could reproject, but I want to get better at python. What am I doing wrong?
I used the python window in ArcGIS.

sCur = arcpy.SearchCursor("boundingbox1", "", "CCS_WGS_1984") ... for row in sCur: ...     geom = row.shape ...     ext = geom.extent  # or row.Shape.extent ...     print "Extent of feature:\nXMin: %f, YMin: %f, \nXMax: %f, YMax: %f" % \ ...           (ext.XMin,ext.YMin,ext.XMax,ext.YMax)


Thank you,
Luke Kaim

Thank you
Luke Kaim (SIE)
Lucas.Kaim@maine.edu
(914)263-7866
"Don???t complain. Just work harder" (Randy Pausch).
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: JSkinn3

Hi Luke,

If your current UTM coordinate system is in the WGS_1984 datum you won't have to apply a transformation, so you could use the WKID in the SearchCursor.  Example:

sCur = arcpy.SearchCursor("boundingbox1", "", 4326)     for row in sCur:         geom = row.shape         ext = geom.extent  # or row.Shape.extent         print "Extent of feature:\nXMin: %f, YMin: %f, \nXMax: %f, YMax: %f" % (ext.XMin,ext.YMin,ext.XMax,ext.YMax)


You can easily obtain the WKID by selecting the coordinate system in the Data Frame Properties and looking at the details under 'Current Coordinate System'.

View solution in original post

0 Kudos
2 Replies
curtvprice
MVP Alum
An approach that may work for you is to try the ProjectAs method of the geometry object to create a new geometry in the new coordinate system.

Geometry (arcpy)
http://resources.arcgis.com/en/help/main/10.1/index.html#//018z00000070000000
0 Kudos
by Anonymous User
Not applicable
Original User: JSkinn3

Hi Luke,

If your current UTM coordinate system is in the WGS_1984 datum you won't have to apply a transformation, so you could use the WKID in the SearchCursor.  Example:

sCur = arcpy.SearchCursor("boundingbox1", "", 4326)     for row in sCur:         geom = row.shape         ext = geom.extent  # or row.Shape.extent         print "Extent of feature:\nXMin: %f, YMin: %f, \nXMax: %f, YMax: %f" % (ext.XMin,ext.YMin,ext.XMax,ext.YMax)


You can easily obtain the WKID by selecting the coordinate system in the Data Frame Properties and looking at the details under 'Current Coordinate System'.
0 Kudos