[mapserver-users] Problems with getting geojson running as WFS response
Jacob Mendt
jacobmendt at googlemail.com
Mon Jul 28 00:36:28 PDT 2014
Hey Steve,
thanks for your response. Right now I normally query something between 500 -
6.000 Features.
Kind regards,
Jacob
Von: Lime, Steve D (MNIT) [mailto:Steve.Lime at state.mn.us]
Gesendet: Freitag, 25. Juli 2014 00:40
An: Jacob Mendt; mapserver-users at lists.osgeo.org
Betreff: RE: [mapserver-users] Problems with getting geojson running as WFS
response
How many features are being returned in your work? The template driver
builds the response in memory, maybe there's a way to periodically flush the
response, although that would require code changes.
Steve
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Jacob Mendt
Sent: Thursday, July 24, 2014 6:13 AM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] Problems with getting geojson running as WFS
response
Hi List,
I dig a bit further in the Mapserver WFS behavior with GeoJSON. After
removing the "MAXFEATURES" parameter from my WFS Request I got the GeoJSON
response running with the DRIVER "OGR/GEOJSON" and "TEMPLATE". With my
actual setup the GeoJSON response with "OGR/GEOJSON" driver is >4 times
faster than the response with the "TEMPLATE" driver. But the problem is, I
need an id attribute for my features (like gml:id in a gml wfs response),
and I find no solution to get one with the "OGR/GEOJSON" driver solution (I
tried "gml_featureid", "wfs_featureid", DATA ".. (Select .) as gid using
unique id ..", ..). With the "TEMPLATE" driver I can handle this in my
template file, but the response is than much slower. So is there a way to
improve the response performance with the "TEMPLATE" driver or to define a
ID property for the "OGR/GEOJSON" driver?
Kind regards,
JM
Von: Jacob Mendt [mailto:jacobmendt at googlemail.com]
Gesendet: Mittwoch, 23. Juli 2014 10:31
An: 'Rahkonen Jukka (Tike)'; mapserver-users at lists.osgeo.org
Betreff: AW: [mapserver-users] Problems with getting geojson running as WFS
response
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; <mailto:mapserver-users at lists.osgeo.org>
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
<http://localhost/cgi-bin/mtbows?map=./test.map&SERVICE=WFS&VERSION=1.0.0&RE
QUEST=getfeature&TYPENAME=test&MAXFEATURES=100&srsname=EPSG:900913&bbox=1518
929.826549386,6766016.954331277,2693002.5808462612,7384239.639015725&outputf
ormat=geojson>
&SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=test&MAXFEATURES=100&
srsname=EPSG:900913&bbox=1518929.826549386,6766016.954331277,2693002.5808462
612,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/20140728/945e9cfe/attachment.htm>
More information about the MapServer-users
mailing list