[OpenLayers-Users] DWITHIN Spatial Filter

Ian Turton ijturton at gmail.com
Mon Dec 5 04:00:53 EST 2011


It looks like you are talking to GeoServer which doesn't use the
distance units in the query, so you are asking for all points within
2000 degrees of the center. I have an open ticket
(http://jira.codehaus.org/browse/GEOS-937) if you want to contribute
(code or cash) to a fix.

However I suspect that what you are trying won't speed things up
anyway. Consider filtering by importance or other attribute and
possibly using a WMS.

Ian


On 5 December 2011 08:11, Shadin <w_ward_W at hotmail.com> wrote:
> *hi list
>
> I'm using a WFS protocol on Vector layer and I wanna filter some features
> using a spatial filter. My filter is of type: DWITHIN
> i need to reduce amount of data retrieved so that they could appear fast
> here is a peace of y code:*
>
> var point =  new OpenLayers.Geometry.Point(45,25)
> point.transform(new OpenLayers.Projection("EPSG:4326"), new
> OpenLayers.Projection("EPSG:3857"));
>
>
> var vessels = new OpenLayers.Layer.Vector("WFS", {
> styleMap: styles,
> strategies:
>  [new OpenLayers.Strategy.Fixed(), new OpenLayers.Strategy.BBOX()],
>  protocol: new OpenLayers.Protocol.WFS({
> url: "http://IP/geoserver/wfs",
> featureType: "Initial",
> featureNS: "http://mapmap.org",
> srsName: "EPSG:3857",
> version: "1.1.0",
> extractAttributes: true,
> isBaseLayer: false,
> visibility: true
>  })
> filters: [
> new OpenLayers.Filter.Spatial({
>              type: OpenLayers.Filter.Spatial.DWITHIN,
>              property: "the_geom",
>              value: point,
>              distance : 2000,
>                          distanceUnits: 'mi'
>
>               })
>                        ]
>                          });
>
> *this is my point (45,25) and my distance 2000 m
> but i haven't noticed any improvement in the displaying speed *
>
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/DWITHIN-Spatial-Filter-tp7062101p7062101.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



-- 
Ian Turton


More information about the Users mailing list