[OpenLayers-Users] Slow WFS filter layer

Ivo Limmen ivo at limmen.org
Mon Jul 2 13:09:19 PDT 2012


Paul,

Looked at your site and I do not really understand why you would want to
use a WFS layer to zoom in on an adres. I would simply:

   1. create a filter based on the input of the user.
   2. create WFS protocol
   3. add a callback on the WFS callback and zoom to the extend of the
   returned features.

But that is just my 2 euro cents.

Ivo

On Mon, Jul 2, 2012 at 9:53 PM, Paul Meems <bontepaarden at gmail.com> wrote:

> Hi Milo,
>
> Thanks for the quick reply.
> 1. Yes, GeoServer and PostGIS are on the same server (dedicated server @
> RackSpace)
> 2. What is enough RAM? I now have 2GB, with only Ubuntu, GeoServer and
> PostGIS
> 3. My dataset has 67k features. I can try tomorrow with a smaller dataset.
> 4. I'm using FF v13 with FireBug.
> 5. I'll also try the empty string as initial filter.
>
> Here's a live sample:
> http://demo.smartdakscan.nl/zonnekaart.php (in Dutch).
>
> Thanks,
>
> Paul
>
>
> 2012/7/2 Milo van der Linden <milo at dogodigi.net>
>
>> I am doing something similar, but my initial filter is an empty string ""
>> that gets set to a valid string later on. I do not use an id, but use the
>> filter to limit results to a viewers organizational unit. I have seen over
>> a hunderd features displayed in less then a second. The underlying table is
>> oracle spatial with less then 10k records.
>>
>> To dig in deeper:
>> 1. Are geoserver and your db on the same machine?
>> 2. Do you have enough RAM?
>> 3. Did you test smaller datasets which generate the same result and are
>> they faster?
>> 4. What browser are you using?
>> On Jul 2, 2012 9:18 PM, "Paul Meems" <bontepaarden at gmail.com> wrote:
>>
>>> I use GeoServer and PostGIS and OpenLayers to show the data.
>>> For one page I'm using a WFS layer and I filter on address.
>>>
>>> The user first need to select an address. This is done with an AJAX call
>>> and the adresID and the location (X, Y) are returned.
>>> I zoom to that location and change my filter.
>>> This is my initial set-up of my layer, an addressID of -1 doesn't exists
>>> so it starts with just the baselayer:
>>>
>>> var myLayer = new OpenLayers.Layer.Vector("tmp", {   displayInLayerSwitcher: true,  strategies: [new OpenLayers.Strategy.BBOX()],  filter: new OpenLayers.Filter.Comparison({           type: OpenLayers.Filter.Comparison.EQUAL_TO,          property: "_adresid",          value: "-1"}),  styleMap: new OpenLayers.StyleMap(),  protocol: new OpenLayers.Protocol.WFS({     url: ".../wfs",    featureType: "myName",    srsName: "EPSG:3857",    geometryName: "geomgoogle"  })});
>>>
>>> But this call takes long because it tries to find the -1 value.
>>> *Q1*: How can I add a WFS layer without data?
>>>
>>> And this is the method I call after the user selects an address:
>>>
>>> function changeFilter(newValue, x, y){   myLayer.destroyFeatures();  filter = new OpenLayers.Filter.Logical({     type: OpenLayers.Filter.Logical.AND,     filters: [       new OpenLayers.Filter.Comparison({           type: OpenLayers.Filter.Comparison.EQUAL_TO,           property: "_adresid",           value: newValue       }),       new OpenLayers.Filter.Spatial({           type: OpenLayers.Filter.Spatial.BBOX,           value: new OpenLayers.Bounds(x-50, y-50, x+50, y+50),           projection: "EPSG:3857"       })   ] });   myLayer.filter = filter;  myLayer.refresh({force: true});
>>>   showAttributes();
>>> }
>>>
>>>
>>>
>>>
>>>
>>> This is working great, but is does take a very long time: about 7-10
>>> seconds.
>>> The result are just a few features: 3-10
>>>
>>> Of course I have an index in the database on _adresid and a spatial
>>> index.
>>>
>>> *Q2*: What else can I do to speed up this filter?
>>>
>>> Thanks,
>>>
>>> Paul
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>
>>>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120702/9b1d9068/attachment-0001.html>


More information about the Users mailing list