Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoUtils.wayFromWays throws NullPointerException #28

Open
johanneshiry opened this issue May 15, 2020 · 0 comments
Open

GeoUtils.wayFromWays throws NullPointerException #28

johanneshiry opened this issue May 15, 2020 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@johanneshiry
Copy link
Member

johanneshiry commented May 15, 2020

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);
@johanneshiry johanneshiry added the bug Something isn't working label May 15, 2020
ckittl added a commit that referenced this issue Jun 5, 2020
@johanneshiry johanneshiry added this to the Version 1.6 milestone Apr 7, 2021
@ckittl ckittl modified the milestones: Version 1.6, Version 2.0 Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants