Skip to main content
deleted 51 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

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?

Edit: I have added an image of what the relevant CSV columns look like. Thank you for the recommendation, Keggering.

enter image description here

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?

Edit: I have added an image of what the relevant CSV columns look like. Thank you for the recommendation, Keggering.

enter image description here

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.

enter image description here

added 205 characters in body
Source Link
Burnz
  • 25
  • 5

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?

Edit: I have added an image of what the relevant CSV columns look like. Thank you for the recommendation, Keggering.

enter image description here

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 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?

Edit: I have added an image of what the relevant CSV columns look like. Thank you for the recommendation, Keggering.

enter image description here

edited tags
Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Projection issues Applying spatial reference when using the arcpy tool XY Table To Point with ArcPy and ArcGIS Pro

deleted 21 characters in body
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404
Loading
Source Link
Burnz
  • 25
  • 5
Loading