Skip to content

Custom areas are imprecise #2683

Closed

Description

@otbutz

I'm trying to use a custom area to describe a simple roadblock. But apparently the small boundingbox also blocks a part of the B11 which is ~110m away: GraphHopper Maps

Custom model
{
  "priority": [
    {
      "if": "in_roadblock",
      "multiply_by": "0"
    }
  ],
  "areas": {
    "roadblock": {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              13.240481423585088,
              49.0267149660803
            ],
            [
              13.240481423585088,
              49.02662503391971
            ],
            [
              13.240618576414914,
              49.02662503391971
            ],
            [
              13.240618576414914,
              49.0267149660803
            ],
            [
              13.240481423585088,
              49.0267149660803
            ]
          ]
        ]
      }
    }
  }
}

Visualized via geojson.io:

geojson

Might be related to #2625

Activity

  1. otbutz commented on Oct 24, 2022

    @otbutz
    ContributorAuthor

    OSM way: https://www.openstreetmap.org/way/118994937#map=17/49.02827/13.24110

    image

    Looks like the simplified BBox check does not properly cover this usecase:

    public static boolean in(Polygon p, EdgeIteratorState edge) {
    BBox bbox = GHUtility.createBBox(edge);
    if (!p.getBounds().intersects(bbox))
    return false;
    if (p.isRectangle())
    return true;
    return p.intersects(edge.fetchWayGeometry(FetchMode.ALL).makeImmutable()); // TODO PERF: cache bbox and edge wayGeometry for multiple area
    }

    The two intersecting bounding boxes are enough to trigger a hit.

  2. added this to the 7.0 milestone on Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions