neo4j-contrib / spatial

Neo4j Spatial is a library of utilities for Neo4j that faciliates the enabling of spatial operations on data. In particular you can add spatial indexes to already located data, and perform spatial operations on the data like searching for data within specified regions or within a specified distance of a point of interest. In addition classes are provided to expose the data to geotools and thereby to geotools enabled applications like geoserver and uDig.
http://neo4j-contrib.github.io/spatial
Other
778 stars 192 forks source link

Exception Importing several OSM files #320

Open wadael opened 7 years ago

wadael commented 7 years ago

Hi, I met this issue while importing two files I exported from the openstreetmap website. On a empty graph, exception occurred during the second import (no matter which file).

I reproduced it with the .osm files in the repo. I can import map.osm, then map2.osm but then it fails to import one-street.osm (or two-street.osm).

neo4j> call spatial.importOSM('/home/jerome/OpenSource/spatial/map.osm'); +-------+ | count | +-------+ | 55 | +-------+

1 row available after 1691 ms, consumed after another 0 ms neo4j> call spatial.importOSM('/home/jerome/OpenSource/spatial/map2.osm'); +-------+ | count | +-------+ | 1072 | +-------+

1 row available after 8323 ms, consumed after another 0 ms neo4j> call spatial.importOSM('/home/jerome/OpenSource/spatial/one-street.osm'); Failed to invoke procedure spatial.importOSM: Caused by: java.util.NoSuchElementException: More than one element in org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$1@5295b11d. First element is 'Node[856]' and the second element is 'Node[128027]'

I'm using 3.1.6 community and Spatial v0.24 neo4j-spatial-0.24-neo4j-3.1.4-server-plugin.jar

wadael commented 7 years ago

Unfortunately, importing to different layers do not do it either.

// CREATING A LAYER neo4j> call spatial.addLayerWithEncoder("AA",'OSMGeometryEncoder','bbox'); +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | node | +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | ({ctime: 1503496868420, geomencoder: "org.neo4j.gis.spatial.osm.OSMGeometryEncoder", layer_class: "org.neo4j.gis.spatial.osm.OSMLayer", layer: "AA"}) | +-------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row available after 78 ms, consumed after another 4 ms

// CHECKING neo4j> CALL spatial.layers(); +-------------------------------------------------------------------------------------+ | name | signature | +-------------------------------------------------------------------------------------+ | "AA" | "EditableLayer(name='AA', encoder=GeometryEncoder(bbox='bbox'))" | | "map2.osm" | "EditableLayer(name='map2.osm', encoder=GeometryEncoder(bbox='bbox'))" | | "map.osm" | "EditableLayer(name='map.osm', encoder=GeometryEncoder(bbox='bbox'))" | +-------------------------------------------------------------------------------------+

3 rows available after 43 ms, consumed after another 1 ms

// IMPORTING FILE1 TO LAYER AA neo4j> CALL spatial.importOSMToLayer('AA', '/home/jerome/OpenSource/spatial/map_ET_Paris.osm'); +-------+ | count | +-------+ | 901 | +-------+

1 row available after 11084 ms, consumed after another 0 ms // IMPORTING FILE 2 TO LAYER 1 neo4j> CALL spatial.importOSMToLayer('AA', '/home/jerome/OpenSource/spatial/paris_iut.osm'); Failed to invoke procedure spatial.importOSMToLayer: Caused by: java.util.NoSuchElementException: More than one element in org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$1@3bedb279. First element is 'Node[159973]' and the second element is 'Node[271303]'

// CREATING A LAYER neo4j> call spatial.addLayerWithEncoder("AB",'OSMGeometryEncoder','bbox'); +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | node | +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | ({ctime: 1503497022959, geomencoder: "org.neo4j.gis.spatial.osm.OSMGeometryEncoder", layer_class: "org.neo4j.gis.spatial.osm.OSMLayer", layer: "AB"}) | +-------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row available after 78 ms, consumed after another 0 ms // IMPORTING FILE 2 TO LAYER 2 neo4j> CALL spatial.importOSMToLayer('AB', '/home/jerome/OpenSource/spatial/paris_iut.osm'); Failed to invoke procedure spatial.importOSMToLayer: Caused by: java.util.NoSuchElementException: More than one element in org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$1@331ffefa. First element is 'Node[159973]' and the second element is 'Node[318320]'

// CREATING A 3RD LAYER neo4j> call spatial.addLayerWithEncoder("AC",'OSMGeometryEncoder','bbox'); +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | node | +-------------------------------------------------------------------------------------------------------------------------------------------------------+ | ({ctime: 1503497155303, geomencoder: "org.neo4j.gis.spatial.osm.OSMGeometryEncoder", layer_class: "org.neo4j.gis.spatial.osm.OSMLayer", layer: "AC"}) | +-------------------------------------------------------------------------------------------------------------------------------------------------------+

1 row available after 74 ms, consumed after another 0 ms

// IMPORTING FILE 2 TO LAYER 3 neo4j> CALL spatial.importOSMToLayer('AC', '/home/jerome/OpenSource/spatial/paris_iut.osm'); Failed to invoke procedure spatial.importOSMToLayer: Caused by: java.util.NoSuchElementException: More than one element in org.neo4j.kernel.impl.coreapi.LegacyIndexProxy$1@54d9e9ea. First element is 'Node[159973]' and the second element is 'Node[365337]'