[Community] Merging PCL featuretypes branch with trunk

Sean Gillies sgillies at frii.com
Thu Feb 23 05:58:51 EET 2006


Hi all,

I branched from the PCL trunk a few weeks ago to begin work on giving  
PCL industrial-strength geometries and a serious feature model. This  
is the "featuretypes" branch at

   http://trac.gispython.org/projects/PCL/browser/PCL/branches/ 
featuretypes

and is just about ready to go. I want to get a thumbs up from others  
before I merge this with the trunk, which I'd like to do before the  
sprint next month. Any objections?

Maybe you'd like to know what's in the featuretypes branch first?  
First, there are the new geometries, built on the GEOS library, and  
described at

   http://trac.gispython.org/projects/PCL/wiki/GeometryDesign

These give you almost exactly the same capabilities inside and  
outside of PostGIS. I made the decision to develop against the GEOS C  
API, instead of using SWIG and the C++ classes at the heart of GEOS,  
because the C API is going to have a better guarantee of stability  
and binary compatibility.

The new feature model is diagrammed at

   http://trac.gispython.org/projects/PCL/wiki/FeatureDesign

It's pretty simple. A *feature* has an id attribute and contains any  
number of properties. These properties may be ints, strings, floats,  
and geometries. More than one geometry, even. Every feature is an  
instance of a *feature type*, and I mean this in the concrete Python  
sense as well as in concept. Feature types derive from the Feature  
class, and new feature types can be created as needed either by using  
the "class" statement

   class Road(Feature):
       ...

   featuretype = Road

or by using the built-in type() function

   featuretype = type('Road', (Feature,), ...)

A *feature store* and *feature source* are much the same as before,  
but now we have the capability of filtering at two points. The back  
end filter (left-most in the diagram) is executed by the data backend  
system (might be PostgreSQL/PostGIS, or be OGR for shapefiles), and  
the front end filter (at the right of the diagram) is executed by  
evaluation of Python expressions. Only PostGIS and in-memory feature  
stores are implemented in the featuretypes branch, I'll wait on the  
shapefiles and OGR data until after the merger.

I've thrown out the old PCL examples and replaced them with a  
geometry example:

   http://trac.gispython.org/projects/PCL/browser/PCL/branches/ 
featuretypes/examples/geometry/geom.py

and a PostGIS example:

   http://trac.gispython.org/projects/PCL/browser/PCL/branches/ 
featuretypes/examples/postgis/pg.py

Please check these out if you're interested in how to use the new  
feature and geometry modules, and let me know if you have any  
questions. I'm not intending for the cartography.data (PCL-Data)  
package to replace ogr2ogr as a data processing tool by any means,  
but it's a big step up from mapscript, and more friendly to the  
Python programmer than ogr.py.

cheers,
Sean

---
Sean Gillies
sgillies at frii dot com
http://zcologia.com/news




More information about the Community mailing list