[mapserver-users] WMS GetFeatureInfo as JSON/GeoJSON
Jakub Štambachr
stambikk at gmail.com
Mon Mar 24 04:14:41 PDT 2014
Hi all,
I've been trying to make mapserver return wms getfeatureinfo as json but to
no success (so far I've been using text/html header, content, footer
templates).
I followed instructions here:
http://mapserver.org/output/template_output.html
My mapfile looks like this:
MAP
.
OUTPUTFORMAT
NAME "geojson"
DRIVER "TEMPLATE"
MIMETYPE "application/json"
FORMATOPTION "FILE=template/geojson.js"
END
.
WEB
.
QUERYFORMAT "geojson"
.
LAYER
TEMPLATE "template/geojson.js"
METADATA
wms_enable_request" "*"
wms_feature_info_mime_type" "gml text/html text/plain"
.
As a template I used a slightly modified version of JSON example found here
http://mapserver.org/output/template_output.html#examples
<http://mapserver.org/output/template_output.html%23examples> :
// mapserver template
[resultset layer=mums]
{
"type": "FeatureCollection",
"features": [
[feature trimlast=","]
{
"type": "Feature",
"id": "[myuniqueid]",
"geometry": {
"type": "PointLineString",
"coordinates": [
{
"type": "Point",
"coordinates": [[x], [y]]
}
]
},
"properties": {
"description": "[description]",
"venue": "[venue]",
"year": "[year]"
}
},
[/feature]
]
}
[/resultset]
According to the instruction I added this
layer=mums&mode=nquery&qformat=geojson to the querystring. The problem is
that now the query returns all the features in the layer (the template gets
filled correctly though). I use INFO_FORMAT=text/html in the wms
getfeatureinfo query.
Any help to get this working would be appreciated, thanks
Jakub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140324/c1b010a4/attachment.htm>
More information about the MapServer-users
mailing list