[Geoserver-users] Buffer function

Could anyone please tell me how to write a wfs filter to "get all the
counties from the county layer that intersect a 200 mile buffer of point
x.y"? I can't seem to get it right.

Thanks,
Steve

Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University

Stephen Crawford ha scritto:

Could anyone please tell me how to write a wfs filter to "get all the
counties from the county layer that intersect a 200 mile buffer of point
x.y"? I can't seem to get it right.

First of all, I hope your data is not in lat/lon, if it is, there
is no hope in hell you'd make it work, since distance based filters
in GeoServer do work only with metric projections (the ogc filtering
standard would allow for metric distances on geographic data, but
we don't support it).

Provided your data is projected and in a projection that is ok for a 200 miles radius without significant distortions, the following should
work:

<ogc:Filter>
     <ogc:DWithin>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Point><gml:coordinates>10 10</gml:coordinates></gml:Point>
        <ogc:Distance units="miles">200</ogc:Distance>
     </ogc:DWithin>
</ogc:Filter>

ah, another thing we don't support is the different unit of measure,
so if your maps are in feets, you'll have specify a distance in feets
(GeoServer won't consider whatever you wrote in the "units" spec afaik).

Sorry for the rough ride :frowning:
Cheers
Andrea

Right now my data is in lat/lon, and I'm able to query the distance in
degrees....though of course this doesn't give me a circle. So I guess I
should create a data layer in the proper projection on the database side,
add this projected layer to geoserver, and then it should work with meters
(the projection units)?

My first thought -- I didn't know about 'Dwithin' -- was to try some
combination of Buffer (around the point) and then Intersect the counties
with the buffer. But I guess I would run into the same problem, which is
you can only use the units of the data set? No reprojection for the spatial
operation?

Thanks,
Steve

-----Original Message-----
From: geoserver-users-bounces@lists.sourceforge.net
[mailto:geoserver-users-bounces@lists.sourceforge.net] On Behalf Of Andrea
Aime
Sent: Tuesday, February 19, 2008 3:32 PM
To: Stephen Crawford
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Buffer function

Stephen Crawford ha scritto:

Could anyone please tell me how to write a wfs filter to "get all the
counties from the county layer that intersect a 200 mile buffer of
point x.y"? I can't seem to get it right.

First of all, I hope your data is not in lat/lon, if it is, there is no hope
in hell you'd make it work, since distance based filters in GeoServer do
work only with metric projections (the ogc filtering standard would allow
for metric distances on geographic data, but we don't support it).

Provided your data is projected and in a projection that is ok for a 200
miles radius without significant distortions, the following should
work:

<ogc:Filter>
     <ogc:DWithin>
        <ogc:PropertyName>the_geom</ogc:PropertyName>
        <gml:Point><gml:coordinates>10 10</gml:coordinates></gml:Point>
        <ogc:Distance units="miles">200</ogc:Distance>
     </ogc:DWithin>
</ogc:Filter>

ah, another thing we don't support is the different unit of measure, so if
your maps are in feets, you'll have specify a distance in feets (GeoServer
won't consider whatever you wrote in the "units" spec afaik).

Sorry for the rough ride :frowning:
Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Stephen Crawford ha scritto:

Right now my data is in lat/lon, and I'm able to query the distance in
degrees....though of course this doesn't give me a circle. So I guess I
should create a data layer in the proper projection on the database side,
add this projected layer to geoserver, and then it should work with meters
(the projection units)?

Yes

My first thought -- I didn't know about 'Dwithin' -- was to try some
combination of Buffer (around the point) and then Intersect the counties
with the buffer. But I guess I would run into the same problem, which is
you can only use the units of the data set? No reprojection for the spatial
operation?

Hum, spatial operations should be re-projected, yes, the problem is that
the spatial filters do pretend a Geometry literal as the second argument, so you cannot invoke the buffer filter function, you have to
specify the circle by hand (very inconvenient, I know).

Cheers
Andrea