# Change from ArcGIS extent box to lat long pair

I have a copy of some ArcGIS log files with bounding box extent information. This example point should map to Montana.

``````Extent:-12711495.260857,6062474.786336,-12711267.136963,6062864.358207
``````

I know that the format is xMin, yMin, xMax, yMax for the points. I've taken the points to make a center point.

``````xCenter = (xMax + xMin)/2.0
yCenter = (yMax + yMin)/2.0
``````

It seems like these points are in meters and I'm having difficulty finding a formula to translate them into lat long point pairs. Is there a direct formula I can use in my scirpt for processing? I don't have a copy of arcpy to use which seems to be the most suggested way to solve the problem.

• Try using the proj4js library which is free to download. This answer provides some of the basics to get started. gis.stackexchange.com/questions/5265/… The hardest part is just making sure you use the correct coordinate system or projections.
– Eok
Jul 31, 2015 at 16:46
• If the points are near Flathead Lake, EPSG:3857 would be my closest bet for the CRS. Jul 31, 2015 at 17:21
• I think you're right that the CRS is EPSG:3857. Jul 31, 2015 at 17:59

I found some help from this gis post: How to convert projected coordinates to lat/lon using Python?

and made a python function to solve my problem

``````def convertEPSGtoWGS(pointX, pointY):
# Spatial Reference System
inputEPSG = 3857
outputEPSG = 4326

# create a geometry from coordinates
point = ogr.Geometry(ogr.wkbPoint)

# create coordinate transformation
inSpatialRef = osr.SpatialReference()
inSpatialRef.ImportFromEPSG(inputEPSG)

outSpatialRef = osr.SpatialReference()
outSpatialRef.ImportFromEPSG(outputEPSG)

coordTransform = osr.CoordinateTransformation(inSpatialRef, outSpatialRef)

# transform point
point.Transform(coordTransform)

# print point in EPSG 4326
print point.GetX(), point.GetY()
``````

I use 3 ways to convert esri extent bbox to lat long

1. use esri javascipt api module ( client side projection, fast, no need ajax, no need internet, projection done in your browser, extremely fast)

first include css, js

This is my working example:

1. proj4js ( need ajax, internet to read projection string from website, due to website does not allow jsonp, not allow cors, you have to setup your own proxy to bypass CORS problem, not easy for normal user )

But if you already known from what to what, then you can just copy past projection string, no internet needed, all projectin done in your browser.

If you don't know project from what to what, projection wkid is dynamic generated in the runtime, then like I said previously, you must need ajax, need internet to read projection string from website on the fly, in the run time. It is not easy, because you have to bypass CORS problem.

Here is my working example:

1. use Arcgis.com hosted web service ( need internet, very slow, not reliable, if ESRI server is crowded, you might get it very slow. Every ajax request can only conver one pair of lat lng)

Here is how to project on website

you can get xmin, ymin from here