[mapserver-users] GeoJSON as WFS output format without template
Hi list! I wanted to have GeoJSON as an output format. Now, if I got the documentation right ( http://mapserver.org/it/development/rfc/ms-rfc-62.html, http://mapserver.org/it/development/rfc/ms-rfc-36.html), I should prepare a template for each layer I'd like to serve as GeoJSON. Is this right or is there a way that MapServer guesses a reasonable format directly from the data, as it does for GML? Indeed, http://mapserver.org/it/output/template_output.html says There are other, simpler, ways to output some of these formats using MapServer. Does this simpler way exist for GeoJSON, too? Regards, Peter ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] [EXTERNAL] GeoJSON as WFS output format without template
Peter, You can use OGR outputformats. Add something like this to your mapfile OUTPUTFORMAT NAME geojson DRIVER OGR/GEOJSON MIMETYPE application/json; subtype=geojson FORMATOPTION STORAGE=stream FORMATOPTION FORM=SIMPLE END Add to your LAYER or MAP METADATA, wfs_getfeature_formatlist” geojson And then in your WFS call add outputformat=geojson. This will return geojson directly in the browser, if you need it to download, you can change the FORMATOPTION to FORM=ZIP See http://mapserver.org/output/ogr_output.html for more detail. Mike -- Michael Smith US Army Corps Remote Sensing GIS/Center From: Peter Hopfgartner peter.hopfgart...@r3-gis.commailto:peter.hopfgart...@r3-gis.com Date: Wednesday, November 13, 2013 at 6:15 AM To: users mapserver mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [EXTERNAL] [mapserver-users] GeoJSON as WFS output format without template Resent-From: Michael Smith michael.sm...@usace.army.milmailto:michael.sm...@usace.army.mil Hi list! I wanted to have GeoJSON as an output format. Now, if I got the documentation right ( http://mapserver.org/it/development/rfc/ms-rfc-62.html, http://mapserver.org/it/development/rfc/ms-rfc-36.html), I should prepare a template for each layer I'd like to serve as GeoJSON. Is this right or is there a way that MapServer guesses a reasonable format directly from the data, as it does for GML? Indeed, http://mapserver.org/it/output/template_output.html says There are other, simpler, ways to output some of these formats using MapServer. Does this simpler way exist for GeoJSON, too? Regards, Peter ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] [EXTERNAL] GeoJSON as WFS output format without template
On 11/13/2013 12:49 PM, Smith, Michael ERDC-RDE-CRREL-NH wrote: Peter, Hi Michael, You can use OGR outputformats. Add something like this to your mapfile OUTPUTFORMAT NAME geojson DRIVER OGR/GEOJSON MIMETYPE application/json; subtype=geojson FORMATOPTION STORAGE=stream FORMATOPTION FORM=SIMPLE END Add to your LAYER or MAP METADATA, wfs_getfeature_formatlist” geojson And then in your WFS call add outputformat=geojson. This will return geojson directly in the browser, if you need it to download, you can change the FORMATOPTION to FORM=ZIP See http://mapserver.org/output/ogr_output.html for more detail. Thanks, this works! Mike -- Michael Smith US Army Corps Remote Sensing GIS/Center Peter R3 GIS http://www.r3-gis.com From: Peter Hopfgartner peter.hopfgart...@r3-gis.com mailto:peter.hopfgart...@r3-gis.com Date: Wednesday, November 13, 2013 at 6:15 AM To: users mapserver mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org Subject: [EXTERNAL] [mapserver-users] GeoJSON as WFS output format without template Resent-From: Michael Smith michael.sm...@usace.army.mil mailto:michael.sm...@usace.army.mil Hi list! I wanted to have GeoJSON as an output format. Now, if I got the documentation right ( http://mapserver.org/it/development/rfc/ms-rfc-62.html, http://mapserver.org/it/development/rfc/ms-rfc-36.html), I should prepare a template for each layer I'd like to serve as GeoJSON. Is this right or is there a way that MapServer guesses a reasonable format directly from the data, as it does for GML? Indeed, http://mapserver.org/it/output/template_output.html says There are other, simpler, ways to output some of these formats using MapServer. Does this simpler way exist for GeoJSON, too? Regards, Peter ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] php mapscript with draw() calling a php wrapper
I have a web service that use a php wrapper as described here, http://mapserver.org/fr/ogc/mapscript.html#php-example except that there is no mapscript, just php code that makes some query to a database in order to add some parametes to the wms request This wrapper ends with readfile ($url); It works fine for all wms request. My problem is when calling this wrapper from another php mapscript page, I can't get the image back More details... I have a php mapscript who prepare a mapobject to print the map In this php mapscript I use $oMap-draw(); to get the image But the layer in $oMap doesn'T have a standard url like /cgi-bin/mapserv?map=. The url is something like http://.../php/ows.php?SERVICE=WMSVeRsIoN=1.1.1Request=GetMapLAYERS=.. ows.php build the correct url /cgi-bin/mapserv?map=.and does the getmap request using readfile($url) But it seems that $oMap-draw() can't deal with what readfile returns, I got this error Error in msDrawMap(): Failed to draw WMS layer named 'RSS'. This most likely happened because the remote WMS server returned an invalid image, and XML exception or another unexpected result in response to the GetMap request. Also check and make sure that the layer's connection URL is valid. I'm sorry It's difficult to explain, I hope I explained well enough... Thanks Steve___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] [OpenLayers-Users] unable to display a geojson layer from mapserver url in openlayers
i am calling, like so: (from http://stackoverflow.com/questions/10368726/how-to-read-external-geojson-file-from-openlayers ) geojson_layer = new OpenLayers.Layer.Vector(GeoJSON, { strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({ url: /cgi-bin/app?map=...ouputformat=geojson, format: new OpenLayers.Format.GeoJSON() }) }); this may be unrelated but the url above creates a valid geojson however both http://www.jsoneditoronline.org/ and http://geojson.io/ throw the following error: Parse error [ coordinates: [[ ]] ] Expecting 'EOF', '}', ',', ']', got ':' (i guess i can always edit my tmpl ( http://osgeo-org.1560.x6.nabble.com/mapserver-5-6-CGI-output-GeoJSON-format-td4890884.html) but it seems unrelated.) thks, jzs ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users