The SearchPointsWithinOrthodromicDistance basically does a search on a
rectangular bounding box, and then inside the result set filters by distance
from the center. The filter probably works only on points as implied by the
class name.

The SpatialTopologyUtils class has a method findClosestEdge, which will do
what you are looking for. If you call it without a distance value, it will
take 1% of the total span of your layer as the search window, so if this
does not make sense for your data (eg. your layer covers a small area, as
you hinted at), then pass in the distance in units of the coordinate system
of the layer (probably WGS84, degrees, if you are using only OSM data). Try
it out and let us know.

See:

   -
   
https://github.com/neo4j/neo4j-spatial/blob/master/src/main/java/org/neo4j/gis/spatial/SpatialTopologyUtils.java
   -
   
https://github.com/neo4j/neo4j-spatial/blob/master/src/test/java/org/neo4j/gis/spatial/TestSpatialUtils.java


On Sun, Jan 16, 2011 at 11:19 AM, Peter Neubauer <
[email protected]> wrote:

> Bryce,
> I think (Craig, correct me if I'm wrong) you need to have a Point
> layer to be able to do that search. The default OSM layer is
> containing a lot of geometries, so I think you first should define a
> layer on top of the full imported one, then search. I did something
> like that in another spike, see
>
> https://github.com/popdevelop/snapplr/blob/master/server_java/src/main/java/com/geosnappr/TaginfoImporter.java#L312
>
> The layer is defined with something like
>
> https://github.com/neo4j/neo4j-spatial/blob/master/src/test/java/org/neo4j/gis/spatial/TestDynamicLayers.java#L26
> on top of the imported full data layer.
>
> Does that help?
>
> Cheers,
>
> /peter neubauer
>
> GTalk:      neubauer.peter
> Skype       peter.neubauer
> Phone       +46 704 106975
> LinkedIn   http://www.linkedin.com/in/neubauer
> Twitter      http://twitter.com/peterneubauer
>
> http://www.neo4j.org               - Your high performance graph database.
> http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.
>
>
>
> On Sat, Jan 15, 2011 at 10:58 PM, bryce hendrix <[email protected]>
> wrote:
> > I'm pretty new to neo4j, so please excuse me if this is a FAQ.
> >
> > I exported OSM data for a city from the OSM site, then imported it using
> the
> > OSMImporter. I can see the layer via the webserver, so I know if got
> > imported okay. Now I would like to find the way nearest to a coordinate
> via
> > the Java API, but I'm not really sure how to do that. I've tried using
> > SearchPointsWithinOrthodromicDistance, but the results of the query are
> > always empty. Can someone give me some tips, or provide a simple example?
> >
> > Thanks in advance,
> > Bryce
> > _______________________________________________
> > Neo4j mailing list
> > [email protected]
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to