Select to view content in your preferred language

MakeXYEventLayer Issues with .csv

464
6
04-16-2014 12:37 PM
KarlRoth
New Contributor
Hello!

I have been working on plotting points on to a world map using latitude longitude coordinates in a .csv file, but they are always plotted in the wrong location.

Here is my code:
                                
arcpy.MakeXYEventLayer_management('C:/FilePath.../SafeCastData.csv',"Latitude","Longitude","TestPlot",
[INDENT][INDENT][INDENT]u'GeographicCoordinateSystem/World/WGS 1984',"Value")[/INDENT] [/INDENT][/INDENT]


This plots them all at the south pole in the World Topology Basemap.

What Works:
Creating a geodatabase, importing csv file into a table, adding data to ArcMAP table of contents, and clicking Display XY... with all of the same settings as above.

Why does using a geodatabase work, but not a csv file? I really need a way to work on the file directly in the python code, and not through ArcMAP.


Thanks in advance!
Tags (2)
0 Kudos
6 Replies
AmyKlug
Regular Contributor
Try switching positions. Longitude is your X and latitude is your Y
0 Kudos
KarlRoth
New Contributor
Great, Thanks! Now I am able to plot my data, but my PointToRaster_conversion() function is not showing up, and it is displaying the wrong values in the table of contents.

Displays values  3.40282e-038- 3.40282e+038 (I assume that's the max and min values allowed!)

My actual value range is from 20-40

I checked the attribute table of my point feature class, and all of the "Values" look fine...
Any idea what's going on here?
0 Kudos
KarlRoth
New Contributor
Sorry I thought I added that part of the code. Here is my point to raster conversion:

arcpy.PointToRaster_conversion(feature class name, "Value", out data name, "MEAN", "Vaule", 10000)

Thanks!
0 Kudos
IanMurray
Frequent Contributor
Karl,

I'm not sure this is the problem, but I thought it was worth point out.

arcpy.PointToRaster_conversion(feature class name, "Value", out data name, "MEAN", "Vaule", 10000)

First you have a syntax error I'm assuming "Vaule" should be "Value".

Secondly, the 5th parameter, which is priority field should only be used when you use the MOST_FREQUENT cell assignment(4th parameter).  It should probably left just a blank string when you use "Mean" cell assignment.  This may or may not have anything to do with you getting the wrong values. 


arcpy.PointToRaster_conversion(feature class name, "Value", out data name, "MEAN", "", 10000)
0 Kudos
KarlRoth
New Contributor
Ian,

I tried all that, and it still didn't work. I can only get PointToRaster to work if I first use Display XY Data on a geodatabase, but both methods (Display XY Data and MakeXYEventLayer) create a multipoint feature class. What's going on here?

The weird thing is that I'm not getting any error messages. Just no output.
0 Kudos
AmyKlug
Regular Contributor
Does it work using the point to raster geoprocessing tool?
0 Kudos