Converting .osm to .obj throws error

Hello!
This is my first time using OSM2World and I am trying to convert a .osm file to a .obj using the .osm file found in this tutorial.
(File can be downloaded here: https://jeffish.com/files/osm2fbx/manhattan-buildings.osm)

However, when I navigate command prompt to the OSM2World folder and then run the command to convert the file:
java -jar ./OSM2World.jar -i ./manhattan-buildings.osm -o ./manhattan.obj --performancePrint

I get the No --config paramter line and then the following error:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "org.osm2world.core.map_data.data.MapNode.getPos()" because "node" is null
at org.osm2world.core.map_data.creation.MapDataCreationUtil.withoutConsecutiveDuplicates(MapDataCreationUtil.java:13)

at org.osm2world.core.map_data.data.MapArea.<init>(MapArea.java:53)
at org.osm2world.core.map_data.data.MapArea.<init>(MapArea.java:45)

at org.osm2world.core.map_data.creation.OSMToMapDataConverter.createMapElements(OSMToMapDataConverter.java:172)

at org.osm2world.core.map_data.creation.OSMToMapDataConverter.createMapData(OSMToMapDataConverter.java:84)

at org.osm2world.core.ConversionFacade.createRepresentations(ConversionFacade.java:258)
at org.osm2world.console.Output.output(Output.java:97)
at org.osm2world.console.OSM2World.executeArgumentsGroup(OSM2World.java:210)
at org.osm2world.console.OSM2World.main(OSM2World.java:144)

I’m sure it’s something simple that I’m doing wrong.
I cannot open the file in the GUI because it is too big.
I am using the most recent version of OSM2World (downloaded today 11/9/2023), Java 17.09, and Windows 10.
Thanks!

1 Like

The error was indeed a result of the input file containing incomplete ways. With the latest changes, OSM2World is now a little less strict: It warns about incomplete ways and omits them (which may result in anything from a missing building to a missing water-body), but does not abort the entire conversion process.

This means that the latest build available on osm2world.org/download is now able to convert this file. However, for best results it is still recommended to cut/filter input data for OSM2World in a manner that results in complete geometries.

I notice the result also contains surprisingly few buildings, and they lack 3D attributes and building parts. I’m not sure whether that’s due to the age of the file, the filtering/preprocessing, or some other issue.

Olá pessoal,

Primeiramente vocĂŞs precisam exportar o arquivo OSM:

  1. Acessar www.openstreetmap.org
  2. Selecionar a localização
  3. Exportar arquivo .osm

Para quem não está conseguindo abrir o arquivo OSM2World, vocês precisam:

  1. Baixar o programa Java (versĂŁo Offline) https://www.java.com/pt-BR/download/manual.jsp e instalar
  2. Baixar a Ăşltima versĂŁo do arquivo OSM2World OSM2World Download
  3. Extrair o arquivo OSM2World-bin.zip
  4. Dentro da pasta extraída clicar com o botão direito no arquivo “OSM2World.jar” > Abrir com > Escolher outro aplicativo > Java™
  5. Pronto!

Agora para converter o OSM para OBJ vocĂŞ deve:

  1. Ir em File
  2. Open OSM file
  3. Novamente em File
  4. Export OBJ file

Para abrir no SketchUp:

  1. Baixar e instalar a extensĂŁo SimLab OBJ Importer no SketchUp
  2. Abra o SketchUp > Extensões > SimLab OBJ importer > import
  3. Faça o cadastro
  4. Baixe a licença que será enviada no seu email e abra no “SimLab OBJ importer”
  5. Uma vez ativado é só importar no mesmo caminho o OBJ SketchUp > Extensões > SimLab OBJ importer > import > Selecione o arquivo .obj
  6. Se o Objeto vier invertido, selecione todo ele, pressione “S” (escala), clique em uma das extremidades no quadrarinho do meio ou no centro do arquivo conforme o local que queira inverter pela outra extremidade e digite “-1 + Enter” para inverter.
  7. SĂł salvar

Espero ter ajudado :wink: