On Wed, Aug 13, 2008 at 08:42:43AM +0200, Eric Lemoine wrote: > On Wed, Aug 13, 2008 at 6:51 AM, Brenningmeyer, Todd > > gmlLayer = new OpenLayers.Layer.GML( "villages", > > "http://localhost/cgi-bin/mapserv.exe",{ > > map:"../htdocs/amap/sites_wfs.map", > > typename: "villages", > > outputformat: "gml2"}// > > ); > > You cannot pass params in this way. With Layer.GML you must do: > > gmlLayer = new OpenLayers.Layer.GML("villages", > > "http://localhost/cgi-bin/mapserv.exe?map=../htdocs/amap/sites_wfs.map&typename=villages&outputformat=gml2"); > > In addition, don't you miss the service, version and request params to > make it an actual WFS request? > > gmlLayer = new OpenLayers.Layer.GML("villages", [ > "http://localhost/cgi-bin/mapserv.exe", > "?map=../htdocs/amap/sites_wfs.map", > "SERVICE=WFS", > "VERSION=1.0.0", > "REQUEST=GetFeature", > "&typename=villages" > "&outputformat=gml2"].join(",") > ); > > But I don't that will fix the getSize problem, which I currently don't > see where it comes from. Sorry.
In OpenLayers, the options object, when passed, will override all the layer's internal settings for any named properties. Specifically, in this case, the 'map' property passed in will override the 'map' property on the layer -- meaning that now 'layer.map' is not an OpenLayers.Map, but instead a string. When map.getSize is called by the renderer later on, it will fail, because strings don't have a getSize method. So, changing this (as Eric suggested) is the correct way to solve this particular problem. Eric, I'm not surprised he didn't include the WFS, et.c params: with other use cases, he didn't have to, because both WMS and WFS build these internally. (The GML layer has no such 'smarts' built in.) Regards, -- Christopher Schmidt MetaCarta _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
