I have a csv file containing about 40,000 rows of data with X, Y (longitude and latitude) data. It is US data, and I have downloaded a state.shp file on which the X, Y points can overlay.

I am able to do it by hand on ArcGIS, but referencing two books on ArcPy ('ArcPy and ArcGIS - geospatial analysis with python' and 'Programming ArcGIS with python cookbook') still doesn't give me a good idea of how to do it using python script with Arcpy, because almost all data used in their examples are not .csv.

Note: I would like to not open ArcGIS at all, but save the map as a jpeg file directly in the python script. Any hints will help.

2 Answers 2


To do this look at the Make XY Event Layer code examples:

Creates a new point feature layer based on x- and y-coordinates defined in a source table. If the source table contains z-coordinates (elevation values), that field can also be specified in the creation of the event layer. The layer created by this tool is temporary.

You can then use arcpy.mapping.AddLayer() to add your layer or layer file to a map, and then use arcpy.mapping.ExportToJPEG() to export that map to JPEG.

  • I am slower than you as always...
    – fatih_dur
    Oct 30, 2015 at 2:55

You can replicate the example in this page about Make XY Event (standalone script one) . You need to add resulting layer to an MXD (preferably to a template with desired layout settings) and then programmatically export to JPEG after setting active data frame's extent to visible extent of your layer (i.e., getExtent).

  • I will try your suggested links tomorrow. One thing I notice is arcpy seems to have its own dataframe structure, I do want to use pandas data frame as well since I like to create different maps using different slices of sample via pandas, is it a good idea to use pandas and arcpy jointly?
    – KubiK888
    Oct 31, 2015 at 4:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.