Code

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 7 years ago Last modified on 10/24/07 23:15:54