[OpenLayers-Users] Problem to load a WFS

Heidt, Christopher M. CHRISTOPHER.M.HEIDT at saic.com
Mon Jun 8 12:58:24 EDT 2009


thats too many features by a long shot.
your browser is hanging because its trying to render way to many geometrys.
 
Your going to have to limit your results even further.
combining a bbox strategy with the clustering strategy is a good setup.
 
personally i have my own filters i use that allow my users to narrow down what they are looking for.
i send those parameters along with my request and let the wfs narrow down the results serverside.

________________________________

From: Steve.Toutant at inspq.qc.ca [mailto:Steve.Toutant at inspq.qc.ca] 
Sent: Monday, June 08, 2009 12:41 PM
To: Heidt, Christopher M.
Cc: Julien-Samuel Lacroix; users at openlayers.org
Subject: RE: [OpenLayers-Users] Problem to load a WFS



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 



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


More information about the Users mailing list