Hi Jeff,

You really did it! I was searching for missing libs, version mismatches and wrong path variables but it was as simple as using the xml file the way you pointed out.
I can confirm that everything works as expected now. I'd like to point out though (for the record) that the step of

ogrinfo wfs-request.xm

does not only test the file but also prepares it to be used. I tested using the file without first using ogrinfo but that did not succeed.

I still do not understand why this was not needed in Mapserver 6 but anyway the problem is solved.

Thanks so much for putting in all that effort and time to help so very quickly.  I think this list is one of the greatest strength of Mapserver and I want to thank everybody who is helping here!

Best
Lars

SkenData GmbH


Am 04.04.19 um 19:13 schrieb Jeff McKenna:
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&amp;VERSION=1.1.0&amp;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


_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to