Select to view content in your preferred language

Coordinate conversion

1407
12
04-28-2013 07:31 PM
MarkPaulson
Occasional Contributor
I manually import a CSV to create a table which I use to make an XY event layer during the creat process I can select the coordinate system of my CSV (NAD 27 LL) and the transformation to use for the conversion to the data frame (Web Mercator). I have been reading about the make xy event functionality, but I am missing the transformation part.
Tags (2)
0 Kudos
12 Replies
ChrisSnyder
Honored Contributor
I could be wrong, but I'm 99% sure you need to use the Project tool (using the xy event layer as input) to properly apply datum transformations for xy event layers. Note that for whatever reason you cannot use the in_memory workspace as an output workspace for the Project tool, but you can use the scratch workspace (arcpy.env.scratchGDB).

Another option would be to apply the coordinate/datum transformation directly to the coordinates in your .csv file wth the Convert Coordinate Notation tool. See: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000tw000000

According to the help, this tool will pick the "correct" datum transformation for you.... Perhaps the Make XY Event Layer tool does this also, but I'm not sure...
0 Kudos
RobertBorchert
Honored Contributor
Create a geodatabase with a feature dataset in the projection you want it to be.  the export your event to that feature dataset.

I manually import a CSV to create a table which I use to make an XY event layer during the creat process I can select the coordinate system of my CSV (NAD 27 LL) and the transformation to use for the conversion to the data frame (Web Mercator). I have been reading about the make xy event functionality, but I am missing the transformation part.
0 Kudos
MarkPaulson
Occasional Contributor
Create a geodatabase with a feature dataset in the projection you want it to be.  the export your event to that feature dataset.

Not sure I follow. I want to import a CSV into and existing data set. Does the MakeXYEventLayer_management spatial reference option take care of this on the fly?
0 Kudos
MarkPaulson
Occasional Contributor
I could be wrong, but I'm 99% sure you need to use the Project tool (using the xy event layer as input) to properly apply datum transformations for xy event layers. Note that for whatever reason you cannot use the in_memory workspace as an output workspace for the Project tool, but you can use the scratch workspace (arcpy.env.scratchGDB).

Another option would be to apply the coordinate/datum transformation directly to the coordinates in your .csv file wth the Convert Coordinate Notation tool. See: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000tw000000

According to the help, this tool will pick the "correct" datum transformation for you.... Perhaps the Make XY Event Layer tool does this also, but I'm not sure...


The convert tool does not support web mercator. I will check on the project tool. I think the MakeXYEventLayer_management spatial reference option will do what I want but I have not had time to check.
0 Kudos
ChrisSnyder
Honored Contributor
I manually import a CSV to create a table which I use to make an XY event layer during the creat process I can select the coordinate system of my CSV (NAD 27 LL) and the transformation to use for the conversion to the data frame (Web Mercator). I have been reading about the make xy event functionality, but I am missing the transformation part.


So wouldn't your workflow simply be:

1. Make your XY event layer specifying NAD 27 LL as the SR
2. Project the event layer to web mercator specifying the proper datum transformation - output would be an on-disk featureclass.

?
0 Kudos
SlavisaCeremidzic
Emerging Contributor
You might need to project your data 2 times.
First project it from NAD27 (source) to NAD83(destination) using right transformation for your region (for US excluding Alaska and Hawaii I gues it should be "NAD_1927_To_NAD_1983_NADCON").
After that grab new projected dataset and project it again from NAD83 to WebMercator using transformation for your region (again for US states other then Alaska and Hawaii it should be WGS_1984_(ITRF00)_To_NAD_1983).
It's all possible using ArcPy Project_Managment function. I am not sure though if event layer can be used with this logic...


Hope this helps.
0 Kudos
MarkPaulson
Occasional Contributor
So wouldn't your workflow simply be:

1. Make your XY event layer specifying NAD 27 LL as the SR
2. Project the event layer to web mercator specifying the proper datum transformation - output would be an on-disk featureclass.

?


Tried that, but with no luck. Ended up calling ESRI support and the tech I spoke with couldn't get the tool to work they are researching it now.
0 Kudos
MarkPaulson
Occasional Contributor
You might need to project your data 2 times.
First project it from NAD27 (source) to NAD83(destination) using right transformation for your region (for US excluding Alaska and Hawaii I gues it should be "NAD_1927_To_NAD_1983_NADCON").
After that grab new projected dataset and project it again from NAD83 to WebMercator using transformation for your region (again for US states other then Alaska and Hawaii it should be WGS_1984_(ITRF00)_To_NAD_1983).
It's all possible using ArcPy Project_Managment function. I am not sure though if event layer can be used with this logic...


Hope this helps.


Shouldn't have to as it transforms fine in desktop...
0 Kudos
TimDine
Frequent Contributor
Is there a reason you're using an event layer in desktop?  The below code could be modified to simply write the geometries into a new feature class rather than printing the values.  It's untested code, but should be pretty close.  It reprojects each row of your csv file into the new coordinate system with the transformation and prints it out.

import arcpy
infile = open("yourfilename.csv","r")
for line in iter(infile):
 aRow = line.split(',')
 point = arcpy.Point()
 point.X = aRow[5] #array position of X value
 point.Y = aRow[6] #array position of Y value
 inputSR = arcpy.SpatialReference("c:/coordsystems/NAD 1983.prj")
 outputSR = arcpy.SpatialReference("c:/coordsystems/NAD 1927.prj")
 pointGeometry = arcpy.PointGeometry(point,inputSR)
 projectedPointGeometry = pointGeometry.projectAs(outputSR,"Name_Of_The_Transformation")
 outputPoint = projectedPointGeomtry.centroid
 print outputPoint.X,outputPoint.Y
0 Kudos