I have a client who needs to find the nearest street for a list of points (his street map doesn't align with his car layers).
So I'd like to extend the WFS Filter function to provide a FindNearest function. I have an example query below.
Ideally, I'd like to pass the id of the point back with the street name, but that is not a requirement. (I suspect it will make it harder).
--
So far, I've worked out how to write a FindNearest query with minor extensions to JCS.
Jody has recommended I create a Geoserver plugin as per: http://docs.codehaus.org/display/GEOSDEV/3+A+Simple+PlugIn
However, if I do that I assume I don't get access to the filter code?
Questions:
1. Which file(s) should I update? I assume it is something in org.vfny.geoserver.wfs.requests .
2. Should this functionality be rolled back into the Geoserver codebase? It is not part of the WFS Spec, but I suspect that it would be useful for others.
<wfs:GetFeature service="WFS" version="1.0.0"
outputFormat="GML2"
xmlns:topp="http://www.openplans.org/topp"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Query typeName="topp:states">
<ogc:PropertyName>topp:STATE_NAME</ogc:PropertyName>
<ogc:Filter>
<ogc:FindNearest>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>-74.817265,40.5296504</gml:coordinates>
</gml:Point>
</ogc:FindNearest>
<ogc:FindNearest>
<ogc:PropertyName>the_geom</ogc:PropertyName>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:coordinates>-74.817265,40.5296504</gml:coordinates>
</gml:Point>
</ogc:FindNearest>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature
--
Cameron Shorter
http://cameron.shorter.net