Created
May 25, 2016 14:20
-
-
Save macoj/2a1ef331067f465810111963a274ea11 to your computer and use it in GitHub Desktop.
trying to get the projection of a shapefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from osgeo import ogr, osr | |
driver = ogr.GetDriverByName('ESRI Shapefile') | |
dataset = driver.Open(r'tabblock2010_25_pophu.shp') | |
# from Layer | |
layer = dataset.GetLayer() | |
spatialRef = layer.GetSpatialRef() | |
print spatialRef | |
# from Geometry | |
feature = layer.GetNextFeature() | |
geom = feature.GetGeometryRef() | |
spatialRef = geom.GetSpatialReference() | |
print spatialRef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment