[OpenLayers-Users] Strategies & query parameters

Egil Möller egil at skytruth.org
Wed Feb 6 03:14:26 PST 2013


Hi!

I have some problems with strategies and filters:

* A filter strategy seems to be entierly ignored when creating the URL
parameters for the protocol (adding a filterToParams-function that
prints filters seems to confirm that my filter strategy filter doesn't
make it to the protocol, only the BBOX filter).

* Updating a filter strategy (setFilter) does not re-request data from
the server

* If I set layer.filter to some filter, this is ANDed in with the bbox
filter, however while GREATER_THAN, SMALLER_THAN etc Logical filters
seems to work fine, BETWEEN filters are just ignored (looking into
Format/QueryStringFilter.js seems to confirm that BETWEEN is just
ignored, and OpenLayers.Console.warn does not print anything by default :/ )

So, how is strategies, filters and protocol query params suppsed to work
together (that is, what is "the big picture" that isn't documented)?

Example code that does not work...

map.addLayers([
  new OpenLayers.Layer.OSM("Simple OSM Map"),
  new OpenLayers.Layer.Vector("Local data", {
    projection: new OpenLayers.Projection("EPSG:4326"), // Same as WGS84
    strategies: [
      new OpenLayers.Strategy.BBOX({resFactor: 1}),
      new OpenLayers.Strategy.Filter({filter:
        new OpenLayers.Filter.Comparison({
            type: OpenLayers.Filter.Comparison.GREATER_THAN,
            property: "when",
            value: new Date(),
        })
      })
    ],
    protocol: new OpenLayers.Protocol.HTTP({
      url: "{% url appomatic_mapserver.views.mapserver %}",
      format: new OpenLayers.Format.SkyTruth({egiltest:4711}),
      params: {},
    })
  })
]);


Best regards,
Egil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130206/c8c554d1/attachment-0001.html>


More information about the Users mailing list