Converting returned DD values to UTM

354
3
06-05-2012 01:10 PM
NickOlson2
New Contributor
Greetings,

I am working with a data set that is in UTM projection and I am retrieving Lat/Long values from my database. I am wanting to use the returned values to clip the input dataset by the extent but I need to convert the returned values to UTM first.  Is there any conversion functions in arcpy that can take a input variable (MinX, MinY, MaxX, MaxY) or a calculation that I can include in my script to make the conversion? I have not had much luck looking in the forum.

I see an arcpy.ConvertCoordinateNotation_management function but it looks like I may have to write the values to a file. Is that the best way?

Thanks for any input you may have.

e.g. My returned values
-92.675391604123291 42.271719081848012 -92.670545464422318 42.275377107963074
Tags (2)
0 Kudos
3 Replies
markdenil
Occasional Contributor III
It seems one really only has two options: creating a point feature class and projecting it, or using ConvertCoordinateNotation, which allows you to skip making the original input featureclass, but requires you to make an input table.

Thus, you don't just need an input FILE, you need an input TABLE.
(AML had a handy option for projecting coordinates in a text file... but enough nostalgia for today.)

ConvertCoordinateNotation also generates fields for the output coordinate values, so it skips needing AddXY after just projecting a feature class.
0 Kudos
NickOlson2
New Contributor
Thank you for your response.

I wrote my values out to a table using the xlwt module and tried to use the ConvertCoordinateNotation function only to realize it creates a point feature class. That won't really solve my problem of returning an extent polygon (MinX, MinY, MaxX, MaxY) that will be used for clip extent.  I think it may be best to create a polygon, project it and then try to return the envelope of the feature extent.
0 Kudos
NobbirAhmed
Esri Regular Contributor
After you run Convert Coordinate Notation, use its output as input to Minimum Bounding Geometry (Data Management > Features) with these parameter values:

Geometry Type: ENVELOPE
Group Option: ALL

It will create a rectangle as output. You can then describe the output to get the extent:

ext = arcpy.Describe("output_envelope").Extent
xmin = ext.XMin
ymin = ext.YMin
...
0 Kudos