[gdal-dev] Reprojecting geometries
Pat Blair
pat.blair at bullberrysystems.com
Thu May 15 14:57:59 EDT 2008
Hello. I am using GDAL/OGR with Python (2.5) bindings. I am wondering
if there are any ready examples that demonstrate the correct process for
reprojecting a geometry. I am iterating through features coming from a
shapefile, and the relevant code I have so far looks similar to this...
input_ds = self.get_driver().Open(r'C:/path/to/my/shapefile.shp')
input_layer = input_ds.GetLayer(0)
input_feature = input_layer.GetNextFeature()
while input_feature is not None:
geometry = input_feature.GetGeometryRef()
print geometry.ExportToWkt() # Looks like good WKT! Hooray!
#
# At this point, I seem to have the geometry... but I need to
# reproject it to WGS-84.
#
# ...then I do some other stuff (destroying the feature, moving to
the next one, etc.)
I have found discussion of creating spatial references in the
documentation and I have the idea that I can create a spatial reference
simply enough using the osr.SpatialReference class and
SetWellKnownGeogCS( "WGS84" ). However, I'm unsure how to use it once I
have it. Is it possible for me to do this?
Any examples or links to more detailed discussion or documentation would
be immensely helpful to me.
Many thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080515/0eef4874/attachment.html
More information about the gdal-dev
mailing list