1

I am trying to transform a shapefile and its datum to GPS (EPSG Projection 4326 - WGS 84) but I get very different result on Google Earth, I write:

from osgeo import ogr, osr

file_name = 'POIS.shp'
driver = ogr.GetDriverByName('ESRI Shapefile')
dataset = driver.Open(file_name)
layer = dataset.GetLayer()
in_spacial_ref = layer.GetSpatialRef()
print (in_spacial_ref)
out_spatial_ref = osr.SpatialReference()
out_spatial_ref.ImportFromEPSG(4326)
coord_trans = osr.CoordinateTransformation(in_spacial_ref, out_spatial_ref)

x, y = 734150.2990000024, 6465754.138
x_gps, y_gps, _ = coord_trans.TransformPoint(x,y, 0)

# Google earth  3° 26.139'E, 45° 17.418'N, 
print (x_gps, y_gps)
# 3.435642392921613 45.290299860385545

print (in_spacial_ref) gives me:

PROJCS["RGF_1993_Lambert_93",
    GEOGCS["GCS_RGF_1993",
        DATUM["Reseau_Geodesique_Francais_1993",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["False_Easting",700000.0],
    PARAMETER["False_Northing",6600000.0],
    PARAMETER["Central_Meridian",3.0],
    PARAMETER["Standard_Parallel_1",44.0],
    PARAMETER["Standard_Parallel_2",49.0],
    PARAMETER["Latitude_Of_Origin",46.5],
    UNIT["Meter",1.0]]

How can I get the exact values of Google Earth? What I am missing here?

1

Argh! I got it, Google Earth writes result on degrees, minutes although they write (on the preferences) decimal minutes it is not decimal!

0.435642*60/100 = 0.2613852 and 0.290299860385545*60/100 = 0.174179916231327

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.