This module should be able to take the standard bounding box variable sent by a GetFeature or FeatureInfo request, and only return points inside of it.

Comments

tmcw’s picture

This change introduces the fundamental XML parsing:

http://drupal.org/cvs?commit=345298

ahtih’s picture

StatusFileSize
new4.86 KB

As I understand, the CVS version (DRUPAL-6--1) has bbox-filtering partially implemented, but commented out. When uncommenting, it works fine for me, after some modifications which I attach as a patch. However I do not expect tmcw to commit it as-is, as there are some controversial changes. The patch that does the following:

* uncomments filter functionality

* changes OpenLayers-specific part of XML parsing; the version in CVS fails parsing filters generated by latest OpenLayers.Protocol.WFS

* swaps filter input BBOX coordinate ordering from "lat,lon" to "lon,lat". This might break code. But since WFS module itself uses "lon,lat" in GetFeature response, it would be strange if filter expected a different ordering. OpenLayers.Protocol.WFS can be configured with either ordering, but forces filter to use same ordering as GetFeature response.

* makes filter to support data source being Geo lon/lat fields. The version in CVS fails there in 2 aspects: 'function' is not set in filter, which makes Geo to apply its default 'distance' filter instead of 'x' or 'y'; and 'units' is not set in filter, which makes Geo to assume its default of 'miles' and converts values to 'meters'. Thus when trying to e.g. specify "geofield.latitude >= 10.0", the CVS version generates SQL "ST_Distance_Sphere(geofield, GeomFromText('POINT(0 0)', 4326)) >= 16000" which obviously returns completely wrong results.

Next I intend to make the filter support Geo WKT data source, with database spatial index.

tmcw, WDYT, am I going in the right direction?

ahtih’s picture

Status: Active » Needs work

FYI, Geo lon/lat support also needs Geo to be patched as per http://drupal.org/node/883010 for it to fully work.

tmcw’s picture

Sure, when the Geo module accepts the patch, I think that this is a good idea on the part of this module, as long as this doesn't break compatibility with datasources other than Geo. I don't use Geo, since it breaks down the idea of data modularity that Views tries to build, but I'd guess that a lot of users are interested in compatibility.

ahtih’s picture

Thanks. Let's see if/when one of Geo maintainers reacts to the Geo patch.

WDYT about points 2 and 3 of my changes list (XML and lat,lon)?

ahtih’s picture

StatusFileSize
new5.01 KB

Attaching a new version of this patch, with better XML error checking.