Skip to content

Instantly share code, notes, and snippets.

@minorua
Created August 5, 2015 02:22
Show Gist options
  • Save minorua/221ca7a2d4e434f91541 to your computer and use it in GitHub Desktop.
Save minorua/221ca7a2d4e434f91541 to your computer and use it in GitHub Desktop.
[snippet] transform coordinates using osr
from osgeo import osr
srin = osr.SpatialReference()
srin.ImportFromEPSG(4326)
srout = osr.SpatialReference()
srout.ImportFromEPSG(3857)
trans = osr.CoordinateTransformation(srin, srout)
trans.TransformPoint(135, 34)
#(15028131.257091938, 4028802.0261344104, 0.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment