[mapserver-users] Setting up a JSONP service

Lars Fricke fricke at gisberater.com
Mon Dec 29 03:34:18 PST 2014


Dear List,

I have a WFS service running under MapServer that I would like to 
operate as JSONP service. I managed to set GEOJSON as output format but 
I get "Cross-Origin-Request Blocked" if I try to call it with a 
Javascript client (using Leaflet L.layerJSON.
The question is: Is it possible to set up a JSONP service from Mapserver 
and if yes, how? My current mapfile looks like this (relevant parts):

"
# in WEB - METADATA
"wfs_getfeature_formatlist" "geojson,csv,ogrgml"

OUTPUTFORMAT
    NAME "geojson"
    DRIVER "OGR/GEOJSON"
    MIMETYPE "application/json; subtype=geojson; charset=utf-8"
    FORMATOPTION "STORAGE=stream"
    FORMATOPTION "FORM=SIMPLE"
    FORMATOPTION "LCO:COORDINATE_PRECISION=5"
   END
"
If this would already be a correct JSONP service, I have to look on the 
Leaflet side for the error...
Thanks for your help.

Cheers

Lars



More information about the MapServer-users mailing list