[ZMapServer-Developers] Re: update: feature querying for PCL and ZCO
Status: Alpha
Brought to you by:
sgillies
|
From: Etienne <eti...@ul...> - 2005-02-03 14:23:20
|
Hi,
It seems very interesting for me. I will try it as soon as I will get it.
I have one question, I want to know if it will be possible to access the spatial
attribute of a selected feature like (ex: left, right, top, bottom coordinate)
for developping a zoom to selected feature function?
Thanks a lot and continue your great work!
Etienne
Selon Sean Gillies <sgi...@fr...>, 02.02.2005:
> Hi all,
>
> Following up on my email about ogr.py ... the primary reason why I want
> to use this module is to support feature querying in PCL (and thereby
> ZCO).
>
> I am about 1/2-way through the querying api that I would like to
> release as PCL 0.7. Right now there is a WFS-ish means of getting
> features from disk data stores (through ogr.py). I'll do the same for
> in-memory data stores next and then defer querying features from
> external data stores (like WFS or PostGIS) until later releases. Chris
> Holmes has expressed interest in ZCO as a WFS client and so I might
> that up to him :)
>
> Here's how the feature querying API will work, example below comes from
> data.IFeatureStore:
>
> def features(properties=[], filter=None, maxfeatures=0, **params):
> """Return an iterator over filtered features
>
> Provides a WFS-ish means to query a store for features.
>
> Attributes
> ----------
> properties : []
> list of property names to be returned with the feature.
>
> filter : filter.Filter
> An instance of Filter.
>
> maxfeatures : int
> Default value of 0 means all features.
>
> params : mapping
> Mapping of key=value parameters that can be added into the
> locals
> namespace for evaluation of PythonFilters only.
>
> calling the features() method of a FeatureStore gives you an iterator
> over stored features, each item of which is a (geom, attributes) tuple.
> The iterator will filter features depending on the "filter" parameter
> above.
>
> We're going to have two kinds of filters:
>
> 1. A very verbose and recursive filter, a fairly literal adaptation of
> the OGC's Filter Encoding spec along the lines of Geotools2
>
> 2. A filter as Python expression as exist now in the expressions of
> cartography.mapping.Rule.
>
> The second is for convenience and will only be useful for local disk
> data stores. The more complete filter (#1) will allow us to create
> full SQL queries to PostGIS or XML requests to an external WFS service,
> two cases that can let us offload feature queries onto highly optimized
> servers. I am also expecting that the #1 filter will provide a good
> basis for filter-generating web widgets.
>
> For you, Etienne, here is an example of the PythonFilter syntax:
>
> >>> pyfilt = filter.PythonFilter('f.FIPS_CNTRY == "UK" and
> g.BBOX(-20,25,60,75)')
> >>> features = store.features()
> >>> for (geom, attributes) in features:
> >>> ... # do something with features
>
> Assuming you have the same world countries data as me, this gets you an
> iterator over all the U.K. countries within the specified bounding box.
> Feature attributes are stuffed into an "f" object (as I've documented
> under Rule filters) and feature geometries are represented by the "g"
> object. I'll be implementing the full complement of spatial operators
> to go along with BBOX, such as intersects, within, contains, etc. The
> ogr.py module will be used to evaluate these operations.
>
> Will that work for you, Etienne? And the rest of you? Does anybody
> have strong feelings about features being a tuple rather than an
> object?
>
> If you want to play with this, you can check it out from CVS. Will
> require the GDAL/OGR software and installation of the Python modules.
> Take a good close look at the rewritten PCL/setup.py file too.
>
> thanks for letting me think out loud here :)
> Sean
>
> --
> Sean Gillies
> sgillies at frii dot com
> http://users.frii.com/sgillies
>
>
>
|