<div dir="ltr"><div>To be clear, Fran - are you saying the issue isn't the result set rather the order? If so I don't know of a way to affect that order.</div><div><br></div>In terms of a nearest feature or features. This would be something that I would be keen on addressing. I've run into a variant of this issue using the CGI and mode=query when searching multiple layers. The query finds the first matching feature but not necessarily the closest. It's an issue primarily with line and point layers when you need to set TOLERANCE values to make things clickable. Jukka, what does the vendor specific extension in GeoServer look like from WFS filter standpoint?<div><br></div><div>--Steve</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 27, 2020 at 10:21 AM Rahkonen Jukka (MML) <<a href="mailto:jukka.rahkonen@maanmittauslaitos.fi">jukka.rahkonen@maanmittauslaitos.fi</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">





<div lang="FI">
<div class="gmail-m_869257473606147577WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">The DWithin function in WFS is a true/false function just like the equivalent PostGIS function
<a href="https://postgis.net/docs/ST_DWithin.html" target="_blank">https://postgis.net/docs/ST_DWithin.html</a>. You can’t find the nearest feature with DWithin. A not so good workaround is to increase the distance until the result is not empty.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Mapserver does not have a vendor specific function for nearest either like Geotools/Geoserver. Especially the pgnearest function that works with PostGIS backend and returns n nearest
 features would be practical for your use case  <a href="https://docs.geotools.org/stable/userguide/library/main/function_list.html" target="_blank">https://docs.geotools.org/stable/userguide/library/main/function_list.html</a>.  Geotools should also have a similar function
 for Oracle that is using the native SDO_NN function.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Unfortunately I can’t say how to proceed for making nearest or nearestN queries with Mapserver.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span>-Jukka Rahkonen-<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US">Lähettäjä:</span></b><span lang="EN-US"> mapserver-users <<a href="mailto:mapserver-users-bounces@lists.osgeo.org" target="_blank">mapserver-users-bounces@lists.osgeo.org</a>>
<b>Puolesta </b>Fran Acuña Parra<br>
<b>Lähetetty:</b> maanantai 27. huhtikuuta 2020 16.59<br>
<b>Vastaanottaja:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Aihe:</b> [mapserver-users] GetFeature WFS request with Spatial Filter DWITHIN<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Following the topic about another question that I sent, I'm using a Getfeature WFS request with a DWITHIN spatial filter to returns the closes feature of a layer given some specific coordinates. The request works fine, but when there are
 several features that match the filter it doesn't returns the closest one in the first position of the response(GML for example). Is there a way to achieve this?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks in advance.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Fran Acuña<u></u><u></u></p>
</div>
</div>
</div>
</div>

_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></blockquote></div>