Open brentfraser opened 4 years ago
I made the changed I suggested above but still got BBOX errors from the server. I looked at their example (which returns some resilts) and saw they did not have a separate BBOX parameter, but instead included it in a Filter, so I added a filter parameter (escaped XML) to the map-source def:
<map-source name="wfs" type="wfs">
<url>http://giswebservices.massgis.state.ma.us/geoserver/wfs</url>
<param name="typename" value="'massgis:GISDATA.PARCELTOWNS_100ACREWIND"/>
<param name="outputFormat" value="GML2"/>
<param name="srsname" value="EPSG:4326"/>
<param name="filter" value="<Filter><BBOX><PropertyName>Geometry</PropertyName><Box srsName='EPSG:4326'> <coordinates>-121.77100,37.368402 -121.76000,37.373473</coordinates> </Box></BBOX></Filter>"/>
<layer name="default">
<style><![CDATA[
{
"line-color" : "#9e8647",
"line-width" : 5
}
]]></style>
<template name="identify" auto="true" />
</layer>
</map-source>
Their server returned results (just a few around San Jose, CA), but GM did not render them.
Yes WFS parameters are different then WMS, and people can pick and choose what their servers support, so it can be challenging to figure out.
I have a WFS service that supports geojson output, maybe you can try it? here is an example URL:
This returns point data so the rendering should be simple (?)
(apologies - the data is on the Oregon coast...)
Any data is appreciated! So many WFS variations to test...
I added a wfs map-source by copying the existing mapserver-wfs and doing a few edits. Good enough to test the Identify, styling, etc.
<map-source name="wfs" type="wfs">
<url>http://localhost/cgi-bin/mapserv.exe</url>
<param name="map" value="C:/ms4w/apps/gm3-demo-data/demo/parcels/parcels.map"/>
<param name="typename" value="ms:parcels"/>
<layer name="default">
<style><![CDATA[
{
"circle-radius": 4,
"circle-color": "#fec44f",
"fill-color": "#fec44f",
"circle-stroke-color": "#d95f0e",
"line-color": "#d95f0e",
"line-width": 2,
"fill-opacity": 0.20,
"line-opacity": 0.80,
"text-field": "{OWNER_NAME}",
"text-color": "#000000"
}
]]></style>
<template name="identify" auto="true" />
</layer>
</map-source>
Fixes have been made, so this issue just needs doc. GM's WFS default params (case-sensitive) names and values are:
'srsname': 'EPSG:3857',
'outputFormat': 'text/xml; subtype=gml/2.1.2',
'service': 'WFS',
'version': '1.1.0',
'request': 'GetFeature',
'bbox': extent.concat('EPSG:3857').join(',')
so if you want to over-ride these in your mapbook, use the same case in the names. For example, use outputFormat
, not OUTPUTFORMAT
:
<param name="outputFormat" value="application/geojson"/>
TBD: test in PR #787
I'm trying to set up a map-source of type="wfs", mostly to test and document. I did some searching and found a candidate server
https://sdmdataaccess.nrcs.usda.gov/WebServiceHelp.aspx#SDMWGS84Geographic
Looking getCapabilities doc, it says the layer typename=mapunitpolythematic
It looks like it prefers (requires?) EPSG:4326 , and GeoMoose sends the BBOX as:
bbox=-10383601.716728799,5535877.43392501, -10351765.69444802,5569471.507856345, EPSG:3857
Which the server rejects:
Error getting BBOX and extent area from WFS request string (shorthand BBOX filter) - invalid Bounding Box coordinate format (shorthand BBOX).
Having a look at vector.js, around line 80:
I see GM will always send the BBOX in EPSG:3857. While I think we need to change this to allow the map-source parameters to override the default GM ones, instead of the other way around (as is is now).