geomoose/gm3

WFS: do not send a MAP= parameter when a <file> is not given in the mapsource (for type="mapserver-wfs")

brentfraser opened this issue · 6 comments

It looks like lots of MapServers are specified to use EPSG:4326, especially when set up as WFS server. Due to a MapServer bug(?) they will respond to query requests in EPSG:3857.

GeoMoose currently (v3.11) has a type="mapserver-wfs" to do requests in EPSG:3857, and reproject response data in EPSG:4326. BUT using "mapserver-wfs" means that it will send a MAP= parameter, which the foreign server will complain about.

A good solution would be not to send a MAP parameter if the GeoMoose admin has not included a tag in the mapsource.

An [better?] alternative would be to implement a tag in the mapsource and have GeoMoose reproject the request parameters and response values.

Test with #787

My current suggested solution:

  1. Do not use mapserver-wfs
  2. Use type="wfs" and do not use a MAP= parameter and set the srcProj= attribute.

I've updated this to review me since #787 has been opened.

You suggestion doesn't work. I've setup a map-source:

    <map-source name="issue772"                 type="wfs"   src-proj="EPSG:4326"  title="World Cities">
        <url>https://demo.mapserver.org/cgi-bin/wfs?</url>
        <param name="cross-origin" value="anonymous"/>
        <param name="typename" value="ms:cities"/>
        <param name="srsname"  value="EPSG:4326"/>
        <config name="pixel-tolerance" value="3" />
        <layer name="cities" title="World Cities">
            <style><![CDATA[
            {
                "circle-radius": 4,
                "circle-color": "#fec44f",
                "fill-color": "#fec44f",
                "circle-stroke-color": "#d95f0e",
                "line-color": "blue",
                "line-width": 2,
                "fill-opacity": 0.20,
                "line-opacity": 0.80,
                "text-field_COMMENTED-OUT": "{OWNER_NAME}",
                "text-color": "#000000"
            }
            ]]></style>
            <template name="identify" auto="true" />
            <template name="select"   auto="true" />
        </layer>
    </map-source>

GeoMoose sends

https://demo.mapserver.org/cgi-bin/wfs?srsname=EPSG%3A4326&outputFormat=text%2Fxml%3B+subtype%3Dgml%2F2.1.2&service=WFS&version=1.1.0&request=GetFeature&bbox=-10378290.697282547%2C5463768.038048627%2C-10330823.302717453%2C5520255.001951372%2CEPSG%3A3857&cross-origin=anonymous&typename=ms%3Acities

Which in general looks OK, except the bbox is in EPSG:3857 (proj is given at the end of the bbox). The getCapabilities of the site specifies only EPSG:4326.

The server responds with

<?xml version='1.0' encoding="UTF-8" ?>
<wfs:FeatureCollection
   xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-basic.xsd 
                       http://mapserver.gis.umn.edu/mapserver https://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&amp;VERSION=1.1.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=ms:cities&amp;OUTPUTFORMAT=XMLSCHEMA">
   <gml:boundedBy>
      <gml:null>missing</gml:null>
   </gml:boundedBy>
</wfs:FeatureCollection>

So no features returned. I'm guessing this is because the bbox is in EPSG:3857.

There is more going on than just he projection issue. I got all the projections working correctly in the #787 branch and it was still refusing to return anything when the bbox= was set. I think that it is an issue with a misconfigured WFS source. To address this I've added the following support:

<config name="strategy" value="all" />

Which will disable the use of the bounding-box loading strategy.