Personal tools
Home » Members » perry » Proposal for an open source Python GIS processing API
Document Actions

Proposal for an open source Python GIS processing API

by Matthew Perry last modified 15-08-2006 19:57

Sure there's gdal and ogr bindings but we need something that works on a layer level.. like the arcgis geoprocessor but more object oriented and pythonic.

Overview

We want a simple, open source, object-oriented python API to build geospatial processing tools that access datasets on a layer/band level for vectors and rasters respectively. The following are example of what this might someday look like:

All scripts start with
#!/bin/python
from whateverwecallthisthing import *

Example 1: Buffering all dirt roads in a roads coverage.


road_data = loadVectorDataset('/data/roads/')
roads = road_data.selectLayer(layername='aat')
dirt_roads = roads.selectByAttribute(query='type == "dirt"')
dirt_buffer = dirt_roads.buffer(distance=50, units=METERS)
dirt_buffer.save(format=SHP, path='/data/dirtbuffer.shp')

Example 2: Reprojecting a raster DEM to the road's spatial reference (srs) and performing hillshade


dem_data = loadRasterDataset('/data/dem.img')
dem = dem_data.selectBand() #only 1 band so this will be sufficient
dem_proj = dem.reproject( srs = roads.getSrs() )
hillshade = dem_proj.hillshade( alt=45, angle=315 )



Example 3: Clip the hillshade to the roads extent and save


hillshade_clip = hillshade.clip( extent = roads.getExtent() )
hillshade_clip.save(format=TIFF, path='/data/hillshade.tif')


Very Rough API proposal



VectorDataset
Methods:
  • selectLayer

RasterDataset
Methods:
  • selectBand


RasterBand

Methods:
  • save
  • reproject
  • hillshade
  • aspect
  • slope
  • rasterAlgebra
  • resample
  • setSrs
  • getSrs
  • getExtent
  • clip

VectorLayer
Methods:
  • save
  • selectByAttribute
  • buffer
  • reproject
  • setSrs
  • getSrs
  • selectByLayer
  • selectByBbox
  • simplify
  • join
  • rasterize
  • clip
  • union
  • intersect
  • dissolve
  • addField
  • calculateField
  • getExtent



































        

Built with Plone