Skip to content

Instantly share code, notes, and snippets.

@v0lat1le
Created November 30, 2015 21:52
Show Gist options
  • Save v0lat1le/b839f24b21356e21dd82 to your computer and use it in GitHub Desktop.
Save v0lat1le/b839f24b21356e21dd82 to your computer and use it in GitHub Desktop.
GDAL ctypes shenanigans
import rasterio
import ctypes
_gdal = ctypes.cdll.LoadLibrary('libgdal.so.1')
OSRNewSpatialReference = _gdal.OSRNewSpatialReference
OSRIsGeographic = _gdal.OSRIsGeographic
OSRIsGeographic.restype = ctypes.c_bool
OSRGetSemiMajor = _gdal.OSRGetSemiMajor
OSRGetSemiMajor.restype = ctypes.c_double
print OSRIsGeographic(crs)
print OSRGetSemiMajor(crs, None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment