0

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.

3
  • 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 '15 at 16:46
  • 1
    If the points are near Flathead Lake, EPSG:3857 would be my closest bet for the CRS. – AndreJ Jul 31 '15 at 17:21
  • I think you're right that the CRS is EPSG:3857. – russOnXMaps Jul 31 '15 at 17:59
1

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)
    point.AddPoint(pointX, pointY)

    # 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()

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.