I think you need to differentiate the bounding boxes of the data in the
layer (stored in the database), and the bounding box of the search query.
The search query is not stored in the database, and will not be seen as a
node or nodes in the database. So if you want to search for data within some
bounding box or polygon, then express that in the search query, and you do
not need to care about how your nodes are stored in the database.

So when you say you want to make a larger bounding box, I assume you are
talking about the query itself. The REST API has the method
findGeometriesInLayer, which takes minx, maxx, miny, maxy parameters and you
can set those to whatever you want for your query.

The REST API also exposes the CQL query language supported by GeoTools. This
allows you to perform SQL-like queries on geometries and feature attributes.
For example, you can search for all objects within a specific polygon (not
just a rectangular bounding box), as well as conforming to certain
attributes. See
http://docs.geoserver.org/latest/en/user/tutorials/cql/cql_tutorial.html for
some examples of CQL.

However, our current CQL support is not fully integrated with the RTree
index. This means that the CQL itself will not benefit from the index, but
be a raw search. You can, however, still get the benefit of the index by
passing in the bounding box separately. So, for example, you want to search
for data in a polygon. Make the polygon object, get it's bounding box and
also the CQL query string. Then make a 'dynamic layer' using the CQL (which
is a bit like making a prepared statement). Then perform the same
'findGeometriesInLayer' method mentioned above, using the bounding box and
the dynamic layer (containing the CQL). This has the effect of using the
RTree index for a first approximate search, followed by pure CQL for the
final mile.

See examples of this in action in the Unit tests in the source code.
https://github.com/neo4j/neo4j-spatial/blob/master/src/test/java/org/neo4j/gis/spatial/ServerPluginTest.java#L109
has
examples of CQL queries on the REST API.

On Tue, Jun 7, 2011 at 5:48 PM, Boris Kizelshteyn <bo...@popcha.com> wrote:

> Thanks! So it seems you are saying that the bounding box represents a
> single
> point and is the same as the lat/lat lon? What if I make the bounding box
> bigger? What I am trying to do is geo queries against a bounding box made
> of
> a set of points, rather than individual points. So the query is, find the
> nodes where the given point falls inside their bounding boxes. Can I do
> this
> with REST?
>
> Thanks!
>
> On Tue, Jun 7, 2011 at 11:34 AM, Craig Taverner <cr...@amanzi.com> wrote:
>
> > Hi,
> >
> > The bounding boxes are used by the RTree index, which is a typical way to
> > index spatial data. For Point data, the lat/long and the bounding box are
> > the same thing, but for other shapes (streets/LineString and Polygons),
> the
> > bounding box is quite different to the actual geometry (which is not just
> a
> > single lat/long, but a set of connected points forming a complex shape).
> >
> > The RTree does not differentiate between points and other geometries,
> > because it cares only about the bounding box, and therefor we provide
> that
> > even for something as simple as a Point.
> >
> > Does that answer the question?
> >
> > Regards, Craig
> >
> > On Tue, Jun 7, 2011 at 4:57 PM, Boris Kizelshteyn <bo...@popcha.com>
> > wrote:
> >
> > > Greetings!
> > >
> > > Perhaps someone using neo4j-spatial can answer this seemingly simple
> > > question. Nodes classified into layers have both lat/lon properties and
> > > bounding boxes, the bounding box seems to be required to establish the
> > > relationship between node and layer, however the node is not found if
> the
> > > lat/lon does not match the query. Can someone explain the relationship
> > > between these two properties on a node?
> > >
> > > Many thanks!
> > > _______________________________________________
> > > Neo4j mailing list
> > > User@lists.neo4j.org
> > > https://lists.neo4j.org/mailman/listinfo/user
> > >
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to