Neo4j-spatial importing OSM missmatching vertices

2019-08-09 15:41发布

This is my method to import osmdata:

private void importOSM(String osm){


    OSMImporter importer = new OSMImporter(osm);
    importer.setCharset(Charset.forName("UTF-8"));

    try{
        importer.importFile(graphDb,osm,false,5000,true);
        importer.reIndex(graphDb,10000);

    }catch(Exception e){
        System.out.println("__________Import Error!! "+e.getMessage());
        e.printStackTrace();
    }
}

When I import an osmdata I get this:

Mismatching vertices size for Polygon:Node[1799298]: 1 != 2
Mismatching vertices size for LineString:Node[2118494]: 14 != 23
Mismatching vertices size for Polygon:Node[1776324]: 1 != 2
Mismatching vertices size for Polygon:Node[1886154]: 1 != 2
Mismatching vertices size for Polygon:Node[2124799]: 1 != 6
Mismatching vertices size for LineString:Node[2207017]: 60 != 85
Mismatching vertices size for LineString:Node[2207587]: 45 != 154
Mismatching vertices size for LineString:Node[2213928]: 8 != 16
Mismatching vertices size for LineString:Node[2213939]: 8 != 16
Mismatching vertices size for LineString:Node[2212505]: 3 != 14
Mismatching vertices found 100 times
Mismatching vertices found 200 times
Mismatching vertices found 300 times
Mismatching vertices found 400 times
Mismatching vertices found 500 times
Mismatching vertices found 600 times
Mismatching vertices found 700 times
Mismatching vertices found 800 times
Mismatching vertices found 900 times
Mismatching vertices found 1000 times
Mismatching vertices found 1100 times

I think this is because the osmdata I imported is only an extract and some streets can't be imported as whole. I imported san-francisco.osm from http://metro.teczno.com/#san-francisco (21 MB bzip’ed XML OSM data). So my question is, is there something wrong in my code or with the data I am importing or is this normal?

greetings

1条回答
beautiful°
2楼-- · 2019-08-09 16:21

Yes, this is normal, and your explanation is correct. When a dump of OSM is made, it is done by node nodes within boundaries. These same nodes belong to ways and relations that extend beyond the boundaries, so you always many Geometries 'chopped up' and as a consequence many warnings like this from the Neo4j Spatial code that is trying to make sense of the OSM file.

You will see warnings like this for the OSM data included in the test cases also. It is hard to find OSM data that has been fully cleaned up so all Geometries are fully contained.

It is possible, however, that actual bugs could cause the same warnings. But I remember I tracked down very many of these warnings when I first ran the OSM importer, and I always found them to be due to ways that were cut during the export.

查看更多
登录 后发表回答