I have a series of CSV files that I need to convert to point feature classes. I have the following code :
# Convert CSV file to raster
import arcpy
workspace = "Y://DEM250m//CSV_Points"
arcpy.env.workspace = workspace # Set environment settings
mycsvs = arcpy.ListFiles("*1980-2010.csv") # Access all historical data
sr = arcpy.SpatialReference()
# Convert CSV to point featureclass
out_table = "Y://DEM250m//CSV_Points//Historical"
for i in mycsvs:
arcpy.management.XYTableToPoint(
workspace + "//" + i,
out_table + "//" + i,
'Latitude',
'Longitude',
'Elevation',
arcpy.SpatialReference(4326)
)
I have tried many variations of the following:
arcpy.SpatialReference(4326)
arcpy.SpatialReference(r'c:/DEM/dem.prj')
arcpy.SpatialReference('WGS 1984')
It never seems to want to project my csv data correctly (it always seems to show up in the middle of the ocean around the equator). I have checked what a lot of other people have posted about here before and tried those solutions, but they never seem to work for me.
What am I doing wrong?
I have added an image of what the relevant CSV columns look like.
sr
definition is incomplete. You can tryarcpy.SpatialReference(4326, 3855)
.