Skip to content

Instantly share code, notes, and snippets.

@jlehtoma
Last active December 17, 2015 17:29
Show Gist options
  • Save jlehtoma/5646164 to your computer and use it in GitHub Desktop.
Save jlehtoma/5646164 to your computer and use it in GitHub Desktop.
Example for EUREF-FIN coordinates transformation into WGS84 CRS using GDAL
#!/usr/bin/env python
# Requires GDAL with python installed https://pypi.python.org/pypi/GDAL
import osgeo.ogr as ogr
import osgeo.osr as osr
# Adapted from http://lists.osgeo.org/pipermail/gdal-dev/2009-October/022284.html
# Create wkt string of point coords
# Sample coordinates taken from https://github.com/teelmo/YlePlus/blob/master/euref-fin2wgs84/example_data.csv
wkt = 'POINT({0} {1})'.format(266054, 6956181)
# Create projection objects
euref_fin = osr.SpatialReference()
# http://spatialreference.org/ref/epsg/3067/
euref_fin.ImportFromEPSG(3067)
wgs84 = osr.SpatialReference()
# http://spatialreference.org/ref/epsg/4326/
wgs84.ImportFromEPSG(4326)
# Create ogr point object, assign projection, reproject
point = ogr.CreateGeometryFromWkt(wkt)
point.AssignSpatialReference(euref_fin)
point.TransformTo(wgs84)
print wkt
print point
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment