[mapserver-users] CONNECTIONTYPE OGR is not working after upgrade to mapserver 7.2.2 from 6.4.1
Jeff McKenna
jmckenna at gatewaygeomatics.com
Thu Apr 4 10:13:12 PDT 2019
Thanks for providing the response, which indeed states "only WFS 1.0.0
or 0.0.14".
I just followed the GDAL WFS driver page now, and locally was able to
generate a map image with a VERSION=1.1.0 request, with the following steps:
- (the following steps are adapted from the GDAL WFS driver page
https://gdal.org/drv_wfs.html )
- create a new file named "wfs-request.xml"
- paste the contents of:
<OGRWFSDataSource>
<URL>http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.1.0&MAXFEATURES=1000</URL>
</OGRWFSDataSource>
- (notice the escaped "&" as noted on the GDAL WFS driver page)
- make a copy of that file (copy/paste "wfs-request.xml" ) in case it is
overwritten by this process
- test this file/connection through the commandline:
ogrinfo wfs-request.xml
- you should see a response listing the available layers:
INFO: Open of `wfs-request.xml'
using driver `WFS' successful.
1: continents
2: cities
- now we know the name to use in our MapServer layer "DATA" parameter,
so in this case we will use "continents"
- edit your .map file and point your layer to that wfs-request.xml in
the CONNECTION, and set the correct DATA parameter from the ogrinfo
response above, such as:
LAYER
NAME "continents-test"
TYPE POLYGON
STATUS ON
CONNECTION "wfs-request.xml"
CONNECTIONTYPE OGR
DATA "continents"
PROJECTION
"init=epsg:4326"
END
CLASS
NAME "My Continents"
STYLE
COLOR 255 128 128
OUTLINECOLOR 96 96 96
END
END
END # Layer
- (use my small mapfile for testing: https://pastebin.com/GYrXyc9A )
- now finally have MapServer generate a map image from that WFS version
1.1.0 connection, by testing at the commandline:
shp2img -m wfs-110-client.map -o ttt.png -all_debug 5
- a file named 'ttt.png' should be generated of the map image, and at
the commandline the response should end with something like:
msSaveImage(ttt.png) total time: 0.015s
msFreeMap(): freeing map at 00228B70.
freeLayer(): freeing layer at 001F1828.
shp2img total time: 3.013s
*** tested with MS4W 4.0.0 (MapServer 7.4.0-dev, GDAL 2.4.0)
Hope that helps,
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
https://gatewaygeomatics.com/
More information about the MapServer-users
mailing list