0

I need to convert EPSG4326 lon/lat tuples to EPSG24373 (Kalianpur 1880 / India zone III). However, when using the Python bindings of OGR and PROJ.4 (pyproj), I get different results.

I wrote the following code:

LON, LAT = 76.661217, 15.183595

import numpy as np
from osgeo import ogr, osr

src_epsg = 4326
dst_epsg = 24373

source = osr.SpatialReference()
source.ImportFromEPSG(src_epsg)

target = osr.SpatialReference()
target.ImportFromEPSG(dst_epsg)

trans = osr.CoordinateTransformation(source, target)

point = ogr.CreateGeometryFromWkt("POINT ({} {})".format(LON,
                                                         LAT))
point.Transform(trans)
print("OGR result: {}".format(point.ExportToWkt()))


from pyproj import Proj, transform
proj = Proj(init="epsg:{}".format(dst_epsg))
x1, y1 = proj(LON, LAT, radians=False)

print("pyproj result: {}".format((x1, y1)))

which yields the results

OGR result: POINT (2607326.263296442106366 542082.358424285310321)
pyproj result: (2384135.3043296584, 495679.3120856479)

From my expectation, the results should be identical, but they aren't. What am I missing here?

3
  • Changing the lat/lon order doesn't give the results that the OP is seeing. I'm not sure it's a duplicate. andreash, can you check the pyproj definition for 24373 or give the +proj definition? – mkennedy Feb 20 '15 at 17:24
  • 1
    The point is that EPSG:24373 does not use meters, but Indian meters. The conversion factor gets missed in pyproj unless you set preserve_units=true. The offset is exactly the scaling factor for meters. The second answer of the linked question gives the right hint. – AndreJ Feb 20 '15 at 19:34
  • Oh, Indian yards. Now I understand. Thanks, @AndreJ ! – mkennedy Feb 20 '15 at 20:37