Select to view content in your preferred language

Calculate Lat and Long using Model Builder

5636
7
Jump to solution
05-07-2013 01:22 AM
MaryMulholland
Emerging Contributor
I have created a model builder to calculate the centroid of a polygon and then export it to a point feature class.  The output coordinates is set to IRENET95_Irish_Transverse_Mercator.  I would like to calculate the Lat and Long values for the point feature class in decimal degrees.  Does anyone know how to calculate this using Model builder.  I know it can be done in desktop by using the Calculate Geometry tool and change the units to Decimal Degrees.  Any help would be appreciated.
0 Kudos
1 Solution

Accepted Solutions
DavidMartin
Frequent Contributor
Use the Project tool http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000007m000000)

You may need to apply a datum transformation, depending on whether or not you want the lat/lon values based on the datum of your current projection (i.e. GCS_IRENET95). The datum transformation can be supplied as one of the parameters to the Project tool, if required.

For example, an appropriate transformation to convert to WGS84 lat/lon would be IRENET95_To_WGS_1984_1 (wkid = 1678)

View solution in original post

0 Kudos
7 Replies
DavidMartin
Frequent Contributor
Use the Project tool http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000007m000000)

You may need to apply a datum transformation, depending on whether or not you want the lat/lon values based on the datum of your current projection (i.e. GCS_IRENET95). The datum transformation can be supplied as one of the parameters to the Project tool, if required.

For example, an appropriate transformation to convert to WGS84 lat/lon would be IRENET95_To_WGS_1984_1 (wkid = 1678)
0 Kudos
DavidMartin
Frequent Contributor
I should perhaps have added that once you've projected your data, you can add the lat/lon as fields using the Add XY Coordinates tool (http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000032000000).

If you want to keep your data in its original projection, but have these lat/lon fields on that original dataset, then I guess you'd need to join the original feature class to the projected one (using Add Join tool) and then pull the fields across (using Add Field / Calculate Field tools).
0 Kudos
MaryMulholland
Emerging Contributor
Thanks for your reply.

When you use the project tool what output coordinate system do you set it to?  My input is a projected coordinate system, if I change it to different projected coordinate system I get an error.  It works when i set it to a Geographic Coordinate System - is this correct?
0 Kudos
DavidMartin
Frequent Contributor
I believe you should be able to project from one projected coordinate system to another, provided any necessary geographic transformation has been supplied (although I'll admit I haven't tested this). To do so would effectively involve the following sequence of events:

1/ un-project to local datum
2/ possible geo-transformation between datums
3/ project to new projection

If you're having problems, you could always separate step 3 into a separate use of the Project tool.
0 Kudos
MaryMulholland
Emerging Contributor
To calculate Long using the calculate geometry tool within desktop all I need to do is select X coordinate of Point, use the same coordinate system of the data source, and change units to Decimal Degrees - see screenshot attached.  Do you think its really necessary to project the data to a new projection?
0 Kudos
DavidMartin
Frequent Contributor
I believe it is, yes, unless someone else is about to educate us otherwise.

Note too that the Calculate Geometry Tool will give you the lat/lon using the datum of the selected coordinate system. You have the choice of using the coordinate system of the layer or of the data frame. In the case of your screenshot, these are one-and-the-same and so you will get your lat/lon based on the GCS_IRENET95 datum.

Assuming you want your lat/lon in WGS84 (perhaps you don't though?) then even the Caculate Geometry Tool will fail to give you the answer you're seeking here. Although admittedly you could coerce it by setting the data frame to use WGS84 and supplying ArcMap with the appropriate transformation as you do so. If you did that, you could then use the coordinate system of the data frame in the Calculate Geometry Tool and get the right answer that way.

But in Model Builder I believe you'll need to follow the approach I've described above. A quick search has brought up a similar question from 2011, and the response then was effectively the same as the one I've given here, so unless there's been any new tools brought out since that could address your problem, then it looks like that's the approach you'll need to take: http://forums.arcgis.com/threads/37718-Calculate-Geometry-in-Model-Builder
0 Kudos
MaryMulholland
Emerging Contributor
Thanks for your response - I got it to work.  I used the project tool to  convert the data from ITM to WGS_1984, then calculated the Lat and Long and then converted the data back to ITM.  😄
0 Kudos