Version 1 (modified by tlp, 10 years ago) (diff)

Added preliminary documentation for OGR Geometries


OGR Geometries


What is OGR?

OGR is an open source C++ library included in GDAL which allows for reading and writing from a variety of vector file formats.

OGR Geometry Objects

>>> from django.contrib.gis.gdal import OGRGeometry, SpatialReference
>>> wkt1 = 'POINT(5 23)' # can be initialized with WKT or HEX
>>> pnt = OGRGeometry(wkt1)
>>> print pnt
POINT (5 23)
>>> print pnt.srs
>>> pnt.srs = 'WGS84' # set the spatial reference
>>> pnt.srs
<django.contrib.gis.gdal.srs.SpatialReference object at 0xb60ab86c>
>>> pnt.transform_to(SpatialReference('NAD27')) # transform the point to a NAD27 spatial reference
>>> print pnt
POINT (5.0 22.999999999997065)
Back to Top