<div dir="ltr"><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">Hello,</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">Something that was never clear to me.<br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">Here is a mapfile for a WFS definition:</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">MAP<br> NAME "Mapserver-Inrap"<br> FONTSET "C:\ms4w\Apache\site\fonts\fonts.txt"<br> OUTPUTFORMAT<br> NAME "geojson"<br> DRIVER "OGR/GEOJSON"<br> MIMETYPE "application/json;subtype=geojson" #option<br> # FORMATOPTION "STORAGE=stream" #requis<br> # FORMATOPTION "FORM=SIMPLE"<br> FORMATOPTION "STORAGE=memory" #requis<br> FORMATOPTION "FORM=SIMPLE"<br> END #fin format<br><br> EXTENT 103362.94 6049964.789658545 1242388.010000001 7108973.60237487 #xmin ymin xmax ymax<br> 51.075383199990654 #xmin ymin xmax ymax<br> UNITS METERS<br> DEBUG 5<br> CONFIG "CPL_DEBUG" "ON"<br> CONFIG "PROJ_DEBUG" "ON"<br> CONFIG MS_ERRORFILE "C:/ms4w/Apache/error/errorMapFile_vue_ol_prescription.txt"<br> <br> SYMBOLSET "C:\ms4w\Apache\site\symbols\symbols.sym"<br><br> PROJECTION # proj de sortie<br> "init=epsg:2154"<br> END<br> <br> WEB <br> METADATA<br> "wfs_title" "WFS Caviar"<br> "wfs_onlineresource" "<a href="http://xxxx/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile/vue_ol_prescription.map">http://xxxx/mapserv.exe?MAP=C:/ms4w/Apache/site/mapfile/vue_ol_prescription.map</a>"<br> "wms_encoding" "UTF-8"<br> "wfs_srs" "EPSG:2154 EPSG:32620 EPSG:3857 EPSG:900913 EPSG:4326"<br> "wfs_enable_request" "*"<br> "wfs_abstract" "blabla"<br> "wfs_getfeature_formatlist" "application/json, GeoJSON, json"<br> END #fin metadata<br> END #end web<br><br>#-----debut prescription<br>LAYER<br> NAME "prescription"<br> TYPE POLYGON<br> CONNECTIONTYPE POSTGIS<br> CONNECTION "host=xxx dbname=activite user=wxxx password=xxx port=5432"<br> DATA "geom from activite.vue_ol_prescription using unique gid using SRID=2154"<br> EXTENT 103362.94 6049964.789658545 1242388.010000001 7108973.60237487 #aide pour performance<br> PROCESSING "CLOSE_CONNECTION=DEFER"<br> CLASS<br> ...<br> END #-----fin classe unique<br> METADATA<br> "gml_include_items" "all" #obligé pour afficher attributs getfeatureinfo<br> "wfs_title" "prescription_2154"<br> #d'après la doc pas besoin si défini dans les metadata de la map cf.10.1<br> #"wfs_srs" "EPSG:2154"<br> "gml_featureid" "gid"<br> "wfs_enable_request" "*"<br> "wfs_use_default_extent_for_getfeature" "false"<br> # si geojson en premier alors geoson dans l'url pour OpenLayers:<br> "wfs_getfeature_formatlist" "GeoJSON, json, application/json"<br> END #fin metadata prescription<br> TEMPLATE "bidon.html"<br>END #fin layer prescription<br><br>END #-----fin mapfile</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">It works fine in QGIS.</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">In a javascript file with the OpenLayers library, I can define a source with an url function like this:</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">
<div style="color:rgb(171,178,191);background-color:rgb(40,44,52);font-family:Consolas,"Courier New",monospace;font-weight:normal;font-size:12px;line-height:16px;white-space:pre"><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(97,175,239)">url</span><span style="color:rgb(86,182,194)">:</span><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(198,120,221)">function</span><span style="color:rgb(171,178,191)"> (extent) {</span></div><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(198,120,221)">return</span><span style="color:rgb(171,178,191)"> (</span></div><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(152,195,121)">"<a href="http://xxxx/cgi-bin/mapserv.exe?MAP=C:/.../vue_ol_prescription.map&">http://xxxx/cgi-bin/mapserv.exe?MAP=C:/.../vue_ol_prescription.map&</a>"</span><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(86,182,194)">+</span></div><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(152,195,121)">"service=WFS&version=1.1.0&request=GetFeature&typename=prescription&"</span><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(86,182,194)">+</span></div><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(152,195,121)">"outputformat=geojson&SRSNAME=EPSG:2154&bbox="</span><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(86,182,194)">+</span></div><div><span style="color:rgb(171,178,191)"> extent.</span><span style="color:rgb(97,175,239)">join</span><span style="color:rgb(171,178,191)">(</span><span style="color:rgb(152,195,121)">","</span><span style="color:rgb(171,178,191)">) </span><span style="color:rgb(86,182,194)">+</span></div><div><span style="color:rgb(171,178,191)"> </span><span style="color:rgb(152,195,121)">",EPSG:3857"</span></div><div><span style="color:rgb(171,178,191)"> )</span></div></div>
</div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large"><br></div><div class="gmail_default" style="font-family:arial,sans-serif;font-size:large">Why can't I use outputformat = application/json though it is permitted by the outpuformat in mapfile layer definition ? I have an error : "application.json not permitted".<br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><span class="gmail_default" style="font-family:arial,sans-serif;font-size:large">L</span><span class="gmail_default" style="font-family:arial,sans-serif;font-size:large">eehan</span></div></div></div></div></div></div></div></div></div></div></div></div>