Neo4j spatial search

200 views
Skip to first unread message

Ben

unread,
Jun 22, 2012, 12:24:38 PM6/22/12
to ne...@googlegroups.com
Hi guys,

I have a neo4j db with a spatial layer, it is taking too long to search and return results (abt 40 mins). Is there any way of improving its performance?

Thanks,
Ben

Axel Morgner

unread,
Jun 22, 2012, 7:19:48 PM6/22/12
to ne...@googlegroups.com
Hi Ben,

40 min sounds far too slow. Better should be 40 ms. :-)

Can you tell a little bit more details, f.e. how many nodes and rels do you have, how do you use Neo4j (embedded Java, REST, language binding), or anything else what might help to figure out what goes wrong (data model, queries, use cases)?

Greetings
Axel

Peter Neubauer

unread,
Jul 4, 2012, 9:59:14 AM7/4/12
to ne...@googlegroups.com
Ben,
got more details on your setup, the dataset and maybe some live
instance to look?

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j

Ben

unread,
Jul 5, 2012, 1:55:55 PM7/5/12
to ne...@googlegroups.com
Well my neo4j db has about 8 millions nodes in it with a spatial layer and it is configured using spring. so to query the db I hit the url with the boundingbox coordinates...it returns the correct results but the spatial query is taking very long time to return. when I am not doing spatial search the search results are returned immediately 

Ben

unread,
Jul 11, 2012, 3:18:19 PM7/11/12
to ne...@googlegroups.com
Centered my issues to -extracting nodes from GeoPipleline to be time consuming. 

pipeline.toNodeList(); is taking too long
 
Any ideas how to optimise?

Thanks

Ben

unread,
Jul 11, 2012, 3:32:58 PM7/11/12
to ne...@googlegroups.com
Is there any alternative for org.neo4j.gis.spatial.pipes.GeoPipeline?

Peter Neubauer

unread,
Jul 11, 2012, 7:22:55 PM7/11/12
to ne...@googlegroups.com

Mmh,
I have not profiled it yet. What dataset are you working on?
/peter

Send from mobile.

Ben

unread,
Jul 12, 2012, 9:16:55 AM7/12/12
to ne...@googlegroups.com
I am working on geonames datasets which has spatial geometry. The Method toNodeList() has as warning comment as :

    /* Warning: this method should *not* be used with pipes that extract many items from a single item 
     * or with pipes that group many items into fewer items.
     */    
    public List<Node> toNodeList() {}

Also the toSpatialDatabaseRecordList() also has the same warning. Is there any alternative for this?

Thanks

Davide

unread,
Jul 12, 2012, 11:12:01 AM7/12/12
to ne...@googlegroups.com
On Thu, Jul 12, 2012 at 3:16 PM, Ben <dbenja...@gmail.com> wrote:
> I am working on geonames datasets which has spatial geometry.

Can we download this dataset somewhere?
is it geonames.org?

> Also the toSpatialDatabaseRecordList() also has the same warning. Is there
> any alternative for this?

You should iterate though the pipeline:

for (SpatialRecord result : pipeline) { ... }

Regards,
--
Davide Savazzi

Ben

unread,
Jul 16, 2012, 9:57:51 AM7/16/12
to ne...@googlegroups.com
Davide,

you can download datasets from http://www.naturalearthdata.com/downloads/

Yes I am iterating the pipe line:
List<SpatialDatabaseRecord> list = pipeline .toSpatialDatabaseRecordList();
for (SpatialDatabaseRecord record : list) {}

or
List<Node> list = pipeline.toNodeList();
for (Node n : list) {}

Both ways take really long time to run.

Ben

unread,
Jul 23, 2012, 9:32:05 AM7/23/12
to ne...@googlegroups.com
Any help from the creators of org.neo4j.gis.spatial.pipes.GeoPipeline?

Davide

unread,
Jul 23, 2012, 4:28:38 PM7/23/12
to ne...@googlegroups.com
On Mon, Jul 23, 2012 at 3:32 PM, Ben <dbenja...@gmail.com> wrote:
> Any help from the creators of org.neo4j.gis.spatial.pipes.GeoPipeline?

Hi,

I don't think there's a quick solution to your problem: we need to
improve the speed of the spatial index...

--
Davide Savazzi

Peter Neubauer

unread,
Jul 23, 2012, 6:43:00 PM7/23/12
to ne...@googlegroups.com
Mmh,
yes, in certain cases we maybe could integrate a native RTree or else
into the starting points, like
https://github.com/karussell/GraphHopper . Davide, do you think that
would be feasible?

Cheers,

/peter neubauer

G: neubauer.peter
S: peter.neubauer
P: +46 704 106975
L: http://www.linkedin.com/in/neubauer
T: @peterneubauer

Wanna learn something new? Come to @graphconnect.
Reply all
Reply to author
Forward
0 new messages