Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

conveniance utilities for ogr

Project Description

ogr_utils is a small wrapper around the GDAL/ogr module. Basically it is an abstraction layer that adds some convience to reading, writing and manipulating geographic data formats. It provides three modules: geometry, research and copy_helper.

Important! Obviously GDAL is required. As installation can be troublesome it is not including as a requirement in this distribution. Please install manually.

Example one. Save a layer based on a query to a new shapefile:

#!/usr/bin/env python

from ogr_utils.copy_helper import CopyHelper
c = CopyHelper()
f = '/home/.../border_segs.shp'
shp =ogr.Open(f,0)
lyr = shp.GetLayer()
>>> 13411
lyr_sel = shp.ExecuteSQL("select * from 'border_segs' where 'FID' < 100 ")
>>> 100

Example two. Save a set of geo objects to a shapefile (or any other file format supported by ogr):

#!/usr/bin/env python

from ogr_utils.geometry import Geometry
g = Geometry( [(xy),], [(fieldname_1, type),(fieldname_2, type),], [(value_field_1,...),(value_field_2,...)] )
f = '/home/.../outfile.shp'

Example three. Get the geomtry of an evelope by it’s lower left and upper right corner:

#!/usr/bin/env python

from ogr_utils.research import Research
prof = Research()
xy1 = (4.84692,52.3706)
xy2 = (4.84397,52.36611)
bb = prof.get_bounding_box( [xy1,xy2] )
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ogr_utils-1.2.tar.gz (9.0 kB) Copy SHA256 Checksum SHA256 Source Aug 27, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting