[OpenLayers-Users] geojson - Performance issue
Andreas Hocevar
ahocevar at opengeo.org
Wed Jan 6 12:02:18 EST 2010
On 2010-01-06 17:10, Steve.Toutant at inspq.qc.ca wrote:
>
> Thanks for this alternative Andreas.
>
> I don't know much about sld but I read some threads and it seems to be
> the right solution. I'll try to find some goog examples.
>From http://presentations.opengeo.org/2009_FOSS4G/gx_tutorial.zip,
gx_tutorial/doc/more_ogc/app.html:
var owsUrl = "/geoserver/ows";
var wms = new OpenLayers.Layer.WMS.Post("WMS", owsUrl,
{format: "image/png"}, {visibility: false}
);
var rule = new OpenLayers.Rule({
filter: new OpenLayers.Filter() // your filter here)
});
rule.symbolizer["polygon"] = symbolizer; // for polygons, otherwise "point" or "line"
var style = new OpenLayers.Style("", {rules: [rule]});
wms.mergeNewParams({
sld_body: new OpenLayers.Format.SLD().write({
namedLayers: [{
name: "foo", // your layer name here
userStyles: [style]
}]
})
});
Regards,
Andreas.
> It never ends...Always something new to learn
>
> Thanks
> Steve
>
> /Steve Toutant, M. Sc./
> Analyste en géomatique
> Secteur environnement
> Direction de la santé environnementale et de la toxicologie
> Institut national de santé publique du Québec
> 945, avenue Wolfe
> Québec, Qc G1V 5B3
>
> Tél.: (418) 650-5115 #5281
> Fax.: (418) 654-3144_
> __steve.toutant at inspq.qc.ca_ <mailto:steve.toutant at inspq.qc.ca>_
> __http://www.inspq.qc.ca_ <http://www.inspq.qc.ca/>
>
>
>
>
>
>
> *Andreas Hocevar <ahocevar at opengeo.org>@openlayers.org*
> Envoyé par : users-bounces at openlayers.org
>
> 06/01/2010 10:35 AM
>
>
> A
> users at openlayers.org
> cc
>
> Objet
> Re: [OpenLayers-Users] geojson - Performance issue
>
>
>
>
>
>
>
>
>
>
>
> Hi,
>
> 2000+ features is way too much for rendering in the browser.
>
> if you use mapserver already, then you can also query the layer as WMS
> layer, using sld_body with a filter. If your query is complex, use
> Layer.WMS.Post instead of Layer.WMS to avoid urls that are too long
> for IE.
>
> Regards,
> Andreas.
>
> On 2010-01-06 16:29, Steve.Toutant at inspq.qc.ca wrote:
> >
> > Hi,
> > I created a WMS (mapserver) layer containing 13400 polygons. It loads
> > in less then 3 seconds. Good.
> >
> > I need to develop a tool for the user so he can create a custom query
> > on this layer to retreive specific polygons. In a form, the user
> > select the parameters and launch the request. Here is the code below.
> > That works, but it takes minutes to render. Per example, a query that
> > returns 2482 polygons, In firebug I see that the query runs in less
> > then 2 seconds.
> > But, It seems that the creation of the geometries is an heavy task. I
> > get this warning in FF
> >
> >
> > I click on Continue several times and then I get geometries in the map.
> >
> > I guess 2482 polygons is simply too much for a vector layer. If that
> > is the case, is there another format then GeoJson I could use? Maybe
> > my approach is totally wrong...
> >
> > Any comments would be appreciated.
> > Thanks for your help,
> > Steve
> >
> > The code used:
> >
> > Ext.Ajax.request({
> > url: 'requeteVulnerabilite.php',
> > method:'POST',
> > params: { inddef: cb_inddefValue},
> > failure: function(){alert("Ca pas marché");},
> > success: function(result, request )
> > {
> > //alert(result.responseText);
> > vulnerabiliteLayer.destroyFeatures();
> > var features = new
> >
> OpenLayers.Format.GeoJSON({'internalProjection':map.baseLayer.projection,'externalProjection':map.baseLayer.projection
> >
> >
> > }).read(result.responseText);
> > var bounds;
> > if(features)
> > {
> > if(features.constructor != Array) {
> > features = [features];
> > }
> > for(var i=0; i<features.length; ++i) {
> > if (!bounds) {
> > bounds =
> > features[i].geometry.getBounds();
> > } else {
> >
> > bounds.extend(features[i].geometry.getBounds());
> > }
> > }
> > vulnerabiliteLayer.addFeatures(features);
> > map.zoomToExtent(bounds);
> > }
> >
> > }
> > });
> >
> >
> >
> >
> > /Steve Toutant, M. Sc./
> > Analyste en géomatique
> > Secteur environnement
> > Direction de la santé environnementale et de la toxicologie
> > Institut national de santé publique du Québec
> > 945, avenue Wolfe
> > Québec, Qc G1V 5B3
> >
> > Tél.: (418) 650-5115 #5281
> > Fax.: (418) 654-3144_
> > __steve.toutant at inspq.qc.ca_ <mailto:steve.toutant at inspq.qc.ca>_
> > __http://www.inspq.qc.ca_ <http://www.inspq.qc.ca/>
> >
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list