TOC()

OGR Geometries

Background

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
None 
>>> 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)
Last modified 17 years ago Last modified on Oct 25, 2007, 1:15:54 AM
Note: See TracWiki for help on using the wiki.
Back to Top