0

I have an Excel file with the coordinates (Latitude/Longitude) for an area. The file contains the coordinate of two corners in the latitude/longitude format.

How can we do to use Python to iterate the process for all coordinates and to export into XY coordinates?

Example of my file:

N°1:  Min_Long   Max_Long  Min_Lat   Max_Lat
     1.5        2.833      6.25         7.33

N°2  -13        5          10          25

... ...

Or else is there a tool in ArcGIS similar to "Add X,Y Data" in ArcMap, that can be used to automatically add this lat/long format?

1

There is a code sample in the Online Help for ListBookmarks that could be adapted to do this fairly quickly.

That code reads bookmarks from a map, whereas yours would need to use a search sursor to read rows from an Excel spreadsheet instead, but the harder part of using arcpy.da.InsertCursor to write your rectangles to a feature class would be identical.

You'll find the code under the heading of:

ListBookmarks example 3

This sample will convert each bookmark in a map document to a feature.

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.