[mapserver-users] Problems with getting geojson running as WFS response

Rahkonen Jukka (Tike) jukka.rahkonen at mmmtike.fi
Sat Jul 26 00:25:06 PDT 2014


Hi,

I would say that if your service is advertising geojson as a supported WFS outputformat in GetCapabilities it should also support all standard WFS requests and parameters and MaxFeatures is such an important parameter that at least that should work for all outputformats. I suggest you to file a bug into github https://github.com/mapserver. The developers woud like to get also a repeatable test case with a small shapefile and mapfile.

-Jukka Rahkonen-
________________________________
Jacob Mendt wrote:

Hi List,

i did some further testing and meet some unexpecting behavior. If I doesn’t use “MAXFEATURES” in my WFS-Request I get back a GeoJSON Response. Is that wanted behavior or do I miss something?

Kind regards,

JM

Von: Jacob Mendt [mailto:jacobmendt at googlemail.com]
Gesendet: Dienstag, 22. Juli 2014 09:51
An: 'Rahkonen Jukka (Tike)'; mapserver-users at lists.osgeo.org
Betreff: AW: [mapserver-users] Problems with getting geojson running as WFS response

Hi Jukka,

yes i tried this. But the behavior stays the same.

JM

Von: Rahkonen Jukka (Tike) [mailto:jukka.rahkonen at mmmtike.fi]
Gesendet: Dienstag, 22. Juli 2014 09:30
An: Jacob Mendt; mapserver-users at lists.osgeo.org<mailto:mapserver-users at lists.osgeo.org>
Betreff: Re: [mapserver-users] Problems with getting geojson running as WFS response

Hi,

Have you tried to request geojson with its MIMETYPE as &format=application/json; subtype=geojson ?

-Jukka Rahkonen-
________________________________
Jacob Mendt wrote:
> Hey List,

> i am right now trying to bring get my Mapserver (Version 6.0.0) WFS running with GeoJSON. But I always get back an empty response. I tried several approaches and my WFS runs with a GML response. So maybe somebody could give me hint. Here is my mapfile:

MAP
                …
PROJECTION
"init=epsg:4314"
END
EXTENT 5.83333301544189 47.2000007629395 23.0000019073486 56

…
#  OUTPUTFORMAT
#    NAME "geojson"
#    DRIVER "OGR/GEOJSON"
#    MIMETYPE "application/json; subtype=geojson"
#    FORMATOPTION "STORAGE=stream"
#    FORMATOPTION "FORM=SIMPLE"
#  END

OUTPUTFORMAT
      NAME "geojson"
      DRIVER "TEMPLATE"
      FORMATOPTION "FILE=/home/test/messtischblatt.js"
      MIMETYPE "application/json; subtype=geojson"
END

WEB
    METADATA
                "wfs_srs" "epsg:900913 epsg:4314 EPSG:3857 EPSG:4326 EPSG:3978"
                "wfs_getfeature_formatlist" "geojson"
    END
END # WEB



  # geojson layer
  LAYER
    TEMPLATE "messtischblatt.js"
    STATUS ON
    NAME "test"
    TYPE POLYGON
    EXTENT 649304.652862922 6090078.57976033 2559975.30438738 7538210.86255982

    DATA "boundingbox from (SELECT * FROM layer ORDER BY titel, time) as foo using unique id using srid=900913"
    CONNECTIONTYPE postgis
    CONNECTION "dbname=*** user=***  password=*** host=*** "

    #DATA "messtischblatt"
    #CONNECTIONTYPE OGR
    #CONNECTION "PG: dbname=*** user=*** password=*** host=***"

    PROJECTION
                "init=epsg:900913"
    END
    METADATA
                "wfs_title" "Test WFS"
                "wfs_srs" "EPSG:4326 EPSG:4314 EPSG:900913 "
                "wfs_enable_request" "*"
                "wfs_getfeature_formatlist" "geojson"
    END
  END

END # MAP#  Tile Index

I test it with a couple of approaches. It tried both Outputformats and both ways of defining a postgis data source. But in any case I get back an empty response. With the template approach I used the following template:

[resultset layer=test]
{
                “type”: “FeatureCollection”,
                “features”: [
                               [feature trimlast=”,”]
                               {
                                               “type”: “Feature”,
                                               “id”: “[id]”,
                                               …
                               }
                               [/feature]
                ]
}
[/resultset]

I run my mapserver also with DEBUG level 5. I got the following log output:

[Mon Jul 21 18:10:21 2014].528584 msFreeMap(): freeing map at 0x19447b0.
[Mon Jul 21 18:10:22 2014].387718 CGI Request 1 on process 4362
[Mon Jul 21 18:10:22 2014].521952 mapserv request processing time (msLoadMap not incl.): 0.134s

My test request is:

http://localhost/cgi-bin/mtbows?map=./test.map&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=test&MAXFEATURES=100&srsname=EPSG:900913&bbox=1518929.826549386,6766016.954331277,2693002.5808462612,7384239.639015725&outputformat=geojson

Could somebody give me an advice?

Kind regards,

JM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140726/89dfc248/attachment-0001.html>


More information about the mapserver-users mailing list