[OpenLayers-Dev] Multiple typenames in getFeature POST request
Alexandre Dube
adube at mapgears.com
Fri Nov 7 16:49:12 EST 2008
Hi devs,
I use OpenLayers from http://svn.openlayers.org/sandbox/topp/wfs.
I needed to have multiple typenames on the same getFeature post
request with BBOX strategy and Cluster Stategy. Problem is, OL doesn't
construct the GML correctly. I don't know if this has been fixed yet,
but I managed to make it work.
Here's the GML that OL produced ( which only returned one type of
features, thereby wrong ) :
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://mapserver.gis.umn.edu/mapserver
http://dev4.mapgears.com/cgi-bin/mapserv?map=/home/mapgears/proj/test/map/test.map&service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=Pylone,Barrage,Alluminerie"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="feature:Alluminerie,Pylone,Barrage"
xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:32187">
<gml:coordinates decimal="." cs="," ts="
">216095.28050192632,5380236.473595727
226184.71949807368,5385323.526404273</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
And here's a request that returns all features from the 3 types :
<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://mapserver.gis.umn.edu/mapserver
http://dev4.mapgears.com/cgi-bin/mapserv?map=/home/mapgears/proj/test/map/test.map&service=WFS&version=1.0.0&request=DescribeFeatureType&TypeName=Pylone,Barrage,Alluminerie"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Query typeName="feature:Barrage"
xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:32187">
<gml:coordinates decimal="." cs="," ts="
">216063.53051907133,5380218.834716363
226216.46948092867,5385341.165283637</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
<wfs:Query typeName="feature:Alluminerie"
xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:32187">
<gml:coordinates decimal="." cs="," ts="
">216063.53051907133,5380218.834716363
226216.46948092867,5385341.165283637</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
<wfs:Query typeName="feature:Pylone"
xmlns:feature="http://mapserver.gis.umn.edu/mapserver">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:BBOX>
<ogc:PropertyName>msGeometry</ogc:PropertyName>
<gml:Box xmlns:gml="http://www.opengis.net/gml"
srsName="EPSG:32187">
<gml:coordinates decimal="." cs="," ts="
">216063.53051907133,5380218.834716363
226216.46948092867,5385341.165283637</gml:coordinates>
</gml:Box>
</ogc:BBOX>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
Instead of one query containing typeName="1,2,3", there should be 3
query with typeName="x" in each. That worked for me. Here's what I had
to change in ./lib/OpenLayers/Format/WFST/v1.js ( near Line 206 ) :
//Before :
his.writeNode("Query", options, node);
//After :
var aszFeatureTypes = options.featureType.split(',');
for (i=0; i<aszFeatureTypes.length; i++){
options.featureType = aszFeatureTypes[i];
this.writeNode("Query", options, node);
}
I'm really not sure if that's the best solution for this, though...
Any comments about this ?
--
Alexandre Dubé
Mapgears
www.mapgears.com
More information about the Dev
mailing list