[OpenLayers-Users] Problem to load a WFS

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Mon Jun 8 14:34:36 EDT 2009


The xml file is 4.5mo

Thank you very much for your help, I'll follow your advices.
Steve

Steve Toutant, M. Sc.
Analyste en géomatique
Secteur environnement
Direction des risques biologiques, environnementaux et occupationnels
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
http://www.inspq.qc.ca
 




Julien-Samuel Lacroix <jlacroix at mapgears.com> 
08/06/2009 01:37 PM

A
Steve.Toutant at inspq.qc.ca
cc
"Heidt, Christopher M." <CHRISTOPHER.M.HEIDT at saic.com>, 
users at openlayers.org
Objet
Re: [OpenLayers-Users] Problem to load a WFS








I think it's possible that too much records make things fail. I strongly 
suggest you to use a WMS layer when zoomed-out and replace it by the WFS 
when zoomed-in. The other option would be to pre-cluster your data on 
the server side before sending the BIG WFS XML to the client.

Just out of curiosity, how big (???Mo) is your 8745 records XML?

Julien

Steve.Toutant at inspq.qc.ca wrote:
> 
> There are 8745 records in the database. That is why I tried to use the 
> cluster strategy in the first place without success because of the error 

> pointed out by Maxime.
> 
> So I tried with a smaller dataset and the wfs layer and the cluster 
> strategy works perfectly.
> It's still doesn't work for the "big" dataset. So I guess there a too 
> many records. Even with the cluster strategy it doesn't load.
> 
> 1- Does the cluster strategy should work for 8745 records requested from 

> a shapefile or postgis?
> 2- I cannot set the visibility of this vector layer to false. The 
> request is sent when the page load.
> 
> Here is the definition of my Vector layer:
> var WFSstyle = new OpenLayers.Style({
>      pointRadius: "${radius}",
>      fillColor: "#71FF00",
>      fillOpacity: 0.5,
>      strokeColor: "#000",
>      strokeWidth: 2,
>      strokeOpacity: 0.3
> }, {
>      context: {
>           radius: function(feature) { 
>                return Math.min(feature.attributes.count,7) + 4;
>           }
>      }
> });
> 
> wfsStrategy = new OpenLayers.Layer.Vector("HLM WFS Strategy",
>      {
>           strategies: [
>                new OpenLayers.Strategy.Fixed(),
>                new OpenLayers.Strategy.Cluster() 
>           ],
>           protocol: new OpenLayers.Protocol.HTTP({
>                url: 
> "
http://geo.inspq.rtss.qc.ca/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante2.map
", 
> 
>                params: {
>                     format: "WFS",
>                     service: "WFS",
>                     request: "GetFeature",
>                     srs: "EPSG:900913",
>                     VERSION : "1.0.0",
>                     typename : 'HLM_shp_wfs2'
>                },
>                format: new OpenLayers.Format.GML()
>           }),
>           styleMap:new OpenLayers.StyleMap({
>                "default": WFSstyle,
>                "select": {
>                     fillColor: "#8aeeef",
>                     strokeColor: "#32a8a9"
>                }
>           })
>      },
>      {
>           extractAttributes:true,
>                   visibility: false,
>           displayInLayerSwitcher: true 
>      });
> 
> /Steve Toutant, M. Sc./
> Analyste en géomatique
> Secteur environnement
> Direction des risques biologiques, environnementaux et occupationnels
> 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/>
> 
> 
> 
> 
> 
> 
> *"Heidt, Christopher M." <CHRISTOPHER.M.HEIDT at saic.com>*
> 
> 08/06/2009 11:02 AM
> 
> 
> A
>                <Steve.Toutant at inspq.qc.ca>, "Julien-Samuel Lacroix" 
> <jlacroix at mapgears.com>, <users at openlayers.org>
> cc
> 
> Objet
>                RE: [OpenLayers-Users] Problem to load a WFS
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> How many features are you getting?
> 
> 
> ------------------------------------------------------------------------
> *From:* users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] *On Behalf Of 
> *Steve.Toutant at inspq.qc.ca*
> Sent:* Monday, June 08, 2009 10:59 AM*
> To:* Julien-Samuel Lacroix; users at openlayers.org*
> Subject:* Re: [OpenLayers-Users] Problem to load a WFS
> 
> 
> In the console TAB there is a GET call to my WFS,
> 
http://geo.inspq.rtss.qc.ca/cgi-bin/mapserv.exe?map=/ms4w/paccSante/map/paccsante2.map&typename=HLM_shp_wfs2&srsName=EPSG%3A900913&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A900913&BBOX=-13586195.339050002,2515633.1906250007,-1219295.6609499985,12299572.809375 

> 
> 
> I can see the Params and the Header but the Reponse tab is empty. After 
> several minutes I got this message
> 
> 
> 
> 
> Here is line #1481
> return envelope;}},parseAttributes:function(node){var attributes={};var 
> childNode=node.firstChild;var 
> 
children,i,child,grandchildren,grandchild,name,value;while(childNode){if(childNode.nodeType==1){children=childNode.childNodes;for(i=0;i<children.length;++i){child=children[i];if(child.nodeType==1){grandchildren=child.childNodes;if(grandchildren.length==1){grandchild=grandchildren[0];if(grandchild.nodeType==3||grandchild.nodeType==4){name=(child.prefix)?child.nodeName.split(":")[1]:child.nodeName;value=grandchild.nodeValue.replace(this.regExes.trimSpace,"");attributes[name]=value;}}}} 

> 
> 
> If I call the link above directly int IE or Firefox I get the XML file.
> Also the memory of computer jump to 3gig and I got to kill firefox (I'm 
> on windows)
> 
> thanks for your help,
> Steve
> 
> 

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090608/5d2c1286/attachment.html


More information about the Users mailing list