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
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
.projectAs(outputSR,"Name_Of_The_Transformation")
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.
So wouldn't your workflow simply be:1. Make your XY event layer specifying NAD 27 LL as the SR2. Project the event layer to web mercator specifying the proper datum transformation - output would be an on-disk featureclass.?
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.
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#//0017000000tw000000According 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...
Create a geodatabase with a feature dataset in the projection you want it to be. the export your event to that feature dataset.
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.