Osm2world difficulties

I’m a beginner trying osm2world here’s what I did:

  1. osm2slice to give me newham.osm.pbf
  2. ./osmconvert64 newham.osm.pbf --complete-ways --complete-multipolygons --complete-boundaries > newham.osm
  3. ./osm2world.sh -i ../newham.osm -o image.png

This results in a fair number of assorted java errors such as:

ERROR[w1176354698]: Min level exceeds total building levels

cannot calculate outlines of Road(w553625636[0]) before cut information is set

java.lang.NullPointerException: Cannot invoke "org.osm2world.scene.material.Material.get(org.osm2world.conversion.O2WConfig)" because the return value of "org.osm2world.scene.material.DefaultMaterials.getSurfaceMaterial(String, org.osm2world.conversion.O2WConfig)" is null

I’d hoped that the conversion parameters in osmconvert64 would get around some of these, but no luck. I haven’t included warnings in the sample, they’re warnings!

Best regards Hugh

OSM2World error readouts which mention a specific OSM ID such as

ERROR[w1176354698]: Min level exceeds total building levels

are not usually a major problem. These report problems related to that specific OSM element, often mapping errors. The effects of such problems are usually limited to that particular object, such as a single building which will look wrong. In this case, way 1176354698 is tagged building:levels=2 + building:min_level=2, which is contradictory.

The other two errors look more serious and could be the reason why OSM2World is crashing and (I assume?) not producing an output file.

What would help me debug this problem is:

  • The stack trace which is printed after that java.lang.NullPointerException.
  • If possible, the input .osm file you’re providing as the -i parameter to OSM2World.

Thanks for taking a look, here’s the stack trace. The osm.pbf is 12Mb so I haven’t included. I’m not allowed to attach so I’ve copy/pasted, sorry.

./osm2world.sh -i ../newham.osm -o image.png

The first argument is not a subcommand, falling back to legacy command line parsing
No --config parameter, using default style (standard.properties).

ERROR: invalid polygon for w1457900087
WARNING[r14663030]: Relation is incomplete, missing members: ['to': Way 5096572, 'sign': Node 214

4333607]
WARNING[r14663029]: Relation is incomplete, missing members: [‘to’: Way 5096572, ‘sign’: Node 2144333607]
WARNING[r14663028]: Relation is incomplete, missing members: [‘sign’: Node 3447992328, ‘intersection’: Node 9121967511]
WARNING[r18259768]: Relation is incomplete, missing members: [‘outer’: Way 678631084]
WARNING[r9221111]: Relation is incomplete, missing members: [‘outline’: Way 372762823]
WARNING[w1493015874]: Non-integer building:levels value: 2.6
WARNING[w1493015877]: Non-integer building:levels value: 2.6
WARNING[w1493015884]: Non-integer building:levels value: 2.3
WARNING[w1493015885]: Non-integer building:levels value: 2.3
WARNING[w1493015886]: Non-integer building:levels value: 2.6
ERROR[w1175312387]: Min level exceeds total building levels
ERROR[w1175312432]: Min level exceeds total building levels
ERROR[w1177478967]: Min level exceeds total building levels
WARNING[w1177478967]: min_height exceeds building (part) height without roof
WARNING[w1490925547]: Non-integer building:levels value: 8.5
WARNING[w1490925545]: Non-integer building:levels value: 8.5
WARNING[w1490925543]: Non-integer building:levels value: 8.5
WARNING[w1490925542]: Non-integer building:levels value: 8.5
WARNING[w1490925540]: Non-integer building:levels value: 8.5
WARNING[w1417058500]: min_height exceeds building (part) height without roof
WARNING[w1417058501]: min_height exceeds building (part) height without roof
ERROR[w1321758592]: Min level exceeds total building levels
WARNING[w1490454471]: Non-integer building:levels value: 1.5
WARNING[w1490454470]: Non-integer building:levels value: 1.5
ERROR[w1176053039]: Min level exceeds total building levels
WARNING[w1491782471]: Non-integer building:levels value: 2.3
WARNING[w1491782466]: Non-integer building:levels value: 2.3
WARNING[w1491782467]: Non-integer building:levels value: 2.3
WARNING[w1491782473]: Non-integer building:levels value: 2.3
WARNING[w1491782468]: Non-integer building:levels value: 2.3
WARNING[w1491782469]: Non-integer building:levels value: 2.3
WARNING[w1491782470]: Non-integer building:levels value: 2.3
WARNING[w1491782472]: Non-integer building:levels value: 2.3
WARNING[w1491782474]: Non-integer building:levels value: 2.3
WARNING[w170221187]: Non-integer building:levels value: 2.5
WARNING[w170221186]: Non-integer building:levels value: 2.5
WARNING[w204334615]: min_height exceeds building (part) height without roof
ERROR: NoSuchElementException
Caused by: java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:970)
at java.base/java.util.Collections.max(Collections.java:713)
at org.osm2world.world.modules.building.roof.SkillionRoof.(SkillionRoof.java:52)
at org.osm2world.world.modules.building.roof.Roof.createRoofForShape(Roof.java:119)
at org.osm2world.world.modules.building.BuildingPart.(BuildingPart.java:119)
at org.osm2world.world.modules.building.BuildingPart.create(BuildingPart.java:676)
at org.osm2world.world.modules.building.Building.lambda$new$2(Building.java:92)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.building.Building.(Building.java:81)
at org.osm2world.world.modules.building.BuildingModule.lambda$applyTo$1(BuildingModule.java:43)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.building.BuildingModule.applyTo(BuildingModule.java:34)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

WARNING[w1416633297]: min_height exceeds building (part) height without roof
WARNING[w1416633296]: min_height exceeds building (part) height without roof
WARNING[w170170607]: Non-integer building:levels value: 2.5
WARNING[w762692250]: min_height exceeds building (part) height without roof
WARNING[w762692249]: min_height exceeds building (part) height without roof
WARNING[w762692252]: min_height exceeds building (part) height without roof
WARNING[w762692251]: min_height exceeds building (part) height without roof
ERROR[w1176354698]: Min level exceeds total building levels
ERROR[w1176257405]: Min level exceeds total building levels
ERROR[w270893092]: Min level exceeds total building levels
WARNING[w1010348592]: min_height exceeds building (part) height without roof
ERROR: NoSuchElementException
Caused by: java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:970)
at java.base/java.util.Collections.max(Collections.java:713)
at org.osm2world.world.modules.building.roof.SkillionRoof.(SkillionRoof.java:52)
at org.osm2world.world.modules.building.roof.Roof.createRoofForShape(Roof.java:119)
at org.osm2world.world.modules.building.BuildingPart.(BuildingPart.java:119)
at org.osm2world.world.modules.building.BuildingPart.create(BuildingPart.java:676)
at org.osm2world.world.modules.building.Building.lambda$new$2(Building.java:92)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.building.Building.(Building.java:81)
at org.osm2world.world.modules.building.BuildingModule.lambda$applyTo$1(BuildingModule.java:43)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.building.BuildingModule.applyTo(BuildingModule.java:34)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

WARNING[r13336829]: Way w637355387 is not connected to intersection n5927906330.
WARNING[r13336828]: Way w661619104 is not connected to intersection n6936836963.
WARNING: Unknown placeholder key ‘distance’ for texture: %{destination} %{distance}
WARNING: 2 similar log entries suppressed
WARNING[r13336821]: Way w1155679534 is not connected to intersection n7369909460.
WARNING: Unknown placeholder key ‘distance’ for texture: %{destination} %{distance}
WARNING: 5 similar log entries suppressed
WARNING[r13336819]: Missing destination in destination_sign
WARNING: Unknown placeholder key ‘distance’ for texture: %{destination} %{distance}
WARNING[r14662790]: Way w204195945 is not connected to intersection n4053161802
WARNING[r14662789]: Way w553805196 is not connected to intersection n4053161802.
WARNING[r14662121]: Way w245168402 is not connected to intersection n26615427
WARNING[r14662122]: Way w1101437380 is not connected to intersection n439552526.
WARNING[r14662123]: Way w1098677344 is not connected to intersection n439552526.
WARNING: Unknown placeholder key ‘distance’ for texture: %{destination} %{distance}
WARNING[r13378742]: Way w220495592 is not connected to intersection n61102590.
WARNING[r14662793]: Way w37607638 is not connected to intersection n4053161802
WARNING[r14662792]: Way w204040569 is not connected to intersection n441167651.
WARNING[r14662791]: Way w553673729 is not connected to intersection n5344182304.
WARNING[r14662117]: Way w245168402 is not connected to intersection n18040070.
WARNING[r14662116]: Way w1101437380 is not connected to intersection n439552526.
WARNING[r14662115]: Missing destination in destination_sign
ERROR[w696129476]: cannot calculate outlines of Road(w696129476[0]) before cut information is set
Caused by: java.lang.IllegalStateException: cannot calculate outlines of Road(w696129476[0]) before cut information is set
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.calculateXZGeometry(AbstractNetworkWaySegmentWorldObject.java:118)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:534)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:49)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.lambda$getGroundObstacles$0(PowerModule.java:917)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.getGroundObstacles(PowerModule.java:914)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.(PowerModule.java:817)
at org.osm2world.world.modules.PowerModule.applyToArea(PowerModule.java:149)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

ERROR[w555567169]: cannot calculate outlines of Road(w555567169[0]) before cut information is set
Caused by: java.lang.IllegalStateException: cannot calculate outlines of Road(w555567169[0]) before cut information is set
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.calculateXZGeometry(AbstractNetworkWaySegmentWorldObject.java:118)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:534)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:49)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.lambda$getGroundObstacles$0(PowerModule.java:917)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.getGroundObstacles(PowerModule.java:914)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.(PowerModule.java:817)
at org.osm2world.world.modules.PowerModule.applyToArea(PowerModule.java:149)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

ERROR[w553625636]: cannot calculate outlines of Road(w553625636[0]) before cut information is set
Caused by: java.lang.IllegalStateException: cannot calculate outlines of Road(w553625636[0]) before cut information is set
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.calculateXZGeometry(AbstractNetworkWaySegmentWorldObject.java:118)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:534)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:49)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.lambda$getGroundObstacles$0(PowerModule.java:917)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.getGroundObstacles(PowerModule.java:914)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.(PowerModule.java:817)
at org.osm2world.world.modules.PowerModule.applyToArea(PowerModule.java:149)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

ERROR[w555567169]: cannot calculate outlines of Road(w555567169[0]) before cut information is set
Caused by: java.lang.IllegalStateException: cannot calculate outlines of Road(w555567169[0]) before cut information is set
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.calculateXZGeometry(AbstractNetworkWaySegmentWorldObject.java:118)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:534)
at org.osm2world.world.network.AbstractNetworkWaySegmentWorldObject.getOutlinePolygonXZ(AbstractNetworkWaySegmentWorldObject.java:49)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.lambda$getGroundObstacles$0(PowerModule.java:917)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:25)
at org.osm2world.util.FaultTolerantIterationUtil.forEach(FaultTolerantIterationUtil.java:37)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.getGroundObstacles(PowerModule.java:914)
at org.osm2world.world.modules.PowerModule$PhotovoltaicPlant.(PowerModule.java:817)
at org.osm2world.world.modules.PowerModule.applyToArea(PowerModule.java:149)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

FATAL: Conversion failed
Caused by: java.lang.NullPointerException: Cannot invoke “org.osm2world.scene.material.Material.get(org.osm2world.conversion.O2WConfig)” because the return value of “org.osm2world.scene.material.DefaultMaterials.getSurfaceMaterial(String, org.osm2world.conversion.O2WConfig)” is null
at org.osm2world.world.modules.SurfaceAreaModule$SurfaceArea.(SurfaceAreaModule.java:105)
at org.osm2world.world.modules.SurfaceAreaModule.applyToArea(SurfaceAreaModule.java:73)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

Exception in thread “main” java.lang.NullPointerException: Cannot invoke “org.osm2world.scene.material.Material.get(org.osm2world.conversion.O2WConfig)” because the return value of “org.osm2world.scene.material.DefaultMaterials.getSurfaceMaterial(String, org.osm2world.conversion.O2WConfig)” is null
at org.osm2world.world.modules.SurfaceAreaModule$SurfaceArea.(SurfaceAreaModule.java:105)
at org.osm2world.world.modules.SurfaceAreaModule.applyToArea(SurfaceAreaModule.java:73)
at org.osm2world.world.modules.common.AbstractModule.applyTo(AbstractModule.java:37)
at org.osm2world.world.creation.WorldCreator.addRepresentationsTo(WorldCreator.java:37)
at org.osm2world.O2WConverterImpl.runConversion(O2WConverterImpl.java:168)
at org.osm2world.O2WConverterImpl.convert(O2WConverterImpl.java:119)
at org.osm2world.O2WConverter.convert(O2WConverter.java:73)
at org.osm2world.console.legacy.LegacyCLIOutput.output(LegacyCLIOutput.java:70)
at org.osm2world.console.legacy.LegacyCLI.executeArgumentsGroup(LegacyCLI.java:215)
at org.osm2world.console.legacy.LegacyCLI.main(LegacyCLI.java:150)
at org.osm2world.console.OSM2World.main(OSM2World.java:52)
at org.osm2world.console.OSM2World.main(OSM2World.java:32)

From looking at the stack trace, it seems that your version of OSM2World crashes when encountering unknown surface=* values in certain circumstances. I’ve released a new latest build available from the download site which includes a fix for this issue. Can you try again with that new version? If it doesn’t resolve the problem, please send me the input file through email so I can reproduce the problem.

Hi Tobias

Thanks for helping with this, much appreciated. It’ll be tomorrow but I haven’t lost sight of it.

Best Hugh