[OpenLayers-Dev] WFS And Zoom Levels

Andrew Ayre andy at britishideas.com
Sun Apr 5 15:27:47 EDT 2009


Solved. I needed to set the projection on the WFS layer to match the 
projection used for the layer data in Mapserver. I guess it is handled 
automatically when using the built in WFS feature class, but not when 
you override it.

Andy

Andrew Ayre wrote:
> I see that if I set:
> 
>   featureClass: OpenLayers.Feature.WFS
> 
> then the WFS data is shown at all zoom levels. So it doesn't work when I 
> use my own feature class. Is there something extra I need to do here to 
> make it work? The initialize function in my feature class isn't called 
> even though the GML is fetched.
> 
> thanks, Andy
> 
> Andrew Ayre wrote:
>> Hi! I have a WFS layer that only shows at the 10 smallest zoom levels. 
>> If I switch to the 11th zoom level (zooming in) the GML file is 
>> fetched but the markers are not added.
>>
>> I have tried setting the maxResolution, minResolution, etc. parameters 
>> for the layer to match the map, but with no luck. Can anyone please 
>> give me some hints?
>>
>> Thanks!
>>
>> map = new OpenLayers.Map ("map", {
>>   controls:[
>>     new OpenLayers.Control.Navigation(),
>>     new OpenLayers.Control.PanZoomBar(),
>>     new OpenLayers.Control.Attribution(),
>>     new OpenLayers.Control.LayerSwitcher()],
>>   maxExtent: new 
>> OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
>>   maxResolution: 156543.0399,
>>   numZoomLevels: 19,
>>   units: 'm',
>>   projection: new OpenLayers.Projection("EPSG:900913"),
>>   displayProjection: new OpenLayers.Projection("EPSG:4326")
>> });
>>
>> var czwfs = new OpenLayers.Layer.WFS("Test Data", 
>> "/mapserverredirect/cgi-bin/mapserv.cgi"
>>   {
>>     typename: "TESTPOINTS2", maxfeatures: 300, map: '../wms.map'
>>   },
>>   {
>>     featureClass: CacheZone.Feature.Points,
>>     maxResolution: map.maxResolution,
>>     minResolution: map.minResolution,
>>     numZoomLevels: map.numZoomLevels,
>>     units: map.units,
>>     scales: map.scales,
>>     resolutions: map.resolutions,
>>     minZoomLevel: map.minZoomLevel,
>>     maxZoomLevel: map.maxZoomLevel
>> });
>>
>> Andy
>>
> 

-- 
Andy
PGP Key ID: 0xDC1B5864



More information about the Dev mailing list