Skip to content

GeoUtils.wayFromWays throws NullPointerException #28

Open
@johanneshiry

Description

@johanneshiry

It seems that there are some issues when using GeoUtils.wayFromWays(...). Depending on the quantity that is provided, a NullPointerException is thrown. I don't have time to investigate the reasons further at the moment, but the issue can be reproduced easily with the following input:

Quantities.getQuantity(50, Units.METRE) -> works.
Quantities.getQuantity(0.05, PowerSystemUnits.KILOMETRE) -> throws NullPointerException

To get the debug .pbf file consult me pls.

Code for debugging (no ons reader provided, osmonaut can be used):

  Entity dortmundRel =
                  p.readOsmFile("inputData/osmData/dortmund.pbf", true)
                      .toList()
                      .filter(x -> x.getEntityType() == EntityType.RELATION)
                      .filter(x -> x.getTags().hasKeyValue("admin_level", "6"))
                      .filter(x -> x.getTags().hasKeyValue("boundary", "administrative"))
                      .filter(x -> x.getTags().hasKeyValue("name", "Dortmund"))
                      .toList()
                      .head();

              List<Way> ways =
                  ((Relation) dortmundRel)
                      .getMembers().stream()
                          .filter(x -> x.getEntity().getEntityType() == EntityType.WAY)
                          .map(
                              entity -> {
                                Way w = ((Way) entity.getEntity());
                                return w;
                              })
                          .collect(Collectors.toList());

              Way dortmundPoly =
                  GeoUtils.wayFromWays(ways, Quantities.getQuantity(50, Units.METRE), 1337);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions