<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi Andreas,<br>
<br>
Thank you for making this even better. I will be able to test the
update tomorrow I assume. I'll let you know.<br>
<br>
Best<br>
<br>
Lars<br>
<br>
Am 15.01.2015 um 12:26 schrieb Eichner, Andreas - SID:<br>
</div>
<blockquote
cite="mid:6F331135492B944D90731CE93743D5681BE79F@FS-EX-DB102.fs.sachsen.de"
type="cite">
<pre wrap="">Hey Lars,
that's great news ;) I did some minor modifications (full patch attached). Now if output format has the format option "JSONP" then default substitutions are applied to it and the "Content-Disposition" header is omitted (causes browsers to display the "Save as" dialog).
The map file should contain
OUTPUTFORMAT
NAME 'jsonp'
DRIVER 'OGR/GEOJSON'
MIMETYPE 'text/javascript; charset=utf-8'
FORMATOPTION 'LCO:COORDINATE_PRECISION=5'
FORMATOPTION 'STORAGE=stream'
FORMATOPTION 'FORM=simple'
FORMATOPTION 'JSONP=%callback%'
END
WEB
METADATA
wfs_getfeature_formatlist "jsonp"
END
VALIDATION
callback '.*'
default_callback 'my_callback'
END
END
A WFS GetFeature request should then set the query string to contain OUTPUTFORMAT=jsonp and CALLBACK=callme. The default value might be useful if you want to run some javascript directly:
default_callback '(function(j){alert(JSON.stringify(j));})'
creates an immediately called anonymous function that displays the JSON. Of course, the real validation pattern should be something more sophisticated.
Just to summarize for all those who didn't follow the thread: The same result could be achieved using the template engine as Steve mentioned and all this is a workaround for a missing datasource creation option in OGR's JSON driver. This patch might provide more performance and might save memory on large result sets.
Kind regards!
</pre>
<blockquote type="cite">
<pre wrap="">-----Ursprüngliche Nachricht-----
Von: <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users-bounces@lists.osgeo.org">mapserver-users-bounces@lists.osgeo.org</a> [<a class="moz-txt-link-freetext" href="mailto:mapserver-users">mailto:mapserver-users</a>-
<a class="moz-txt-link-abbreviated" href="mailto:bounces@lists.osgeo.org">bounces@lists.osgeo.org</a>] Im Auftrag von Lars Fricke
Gesendet: Mittwoch, 14. Januar 2015 17:17
An: <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
Betreff: Re: [mapserver-users] Setting up a JSONP service
Hello Andreas,
I confirm your solution is working perfectly well. I succeeded to
integrate the JSONP output into my web application with no conflicts.
Funny this depended so much on the version of code I happened to grab
wrong. Sorry for producing extra work by that.
I'd love to see this go to the repositories, it's really helpful until
someone will extend OGR.
So thanks again from Mecklenburg to Saxony :-)
Best
Lars
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
mapserver-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapserver-users">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a></pre>
</blockquote>
</blockquote>
<br>
</body>
</html>