pelias / wof-admin-lookup

Who's on First Admin Lookup for the Pelias Geocoder
https://pelias.io
MIT License
9 stars 24 forks source link

Locality is missing for some locations #304

Open ShoSashko opened 3 years ago

ShoSashko commented 3 years ago

Describe the bug It looks like there some issues with locality for some returned regions. In this particular case, locality is not present in whosonfirst response.

In whosonfirst-data-admin-ua-latest.db that I use, I can confirm the data is present. image

For example: https://api.dev.geocode.earth/v1/autocomplete?size=30&boundary.rect.max_lat=49.909829&boundary.rect.max_lon=24.132048&boundary.rect.min_lat=49.757474&boundary.rect.min_lon=23.883483&lang=en&text=%D0%9A%D1%83%D1%80%D0%BE%D1%80%D1%82%D0%BD%D0%B0&api_key=ge-1e618cf3d7bd023d

  "features": [
   {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          23.960205,
          49.903751
        ]
      },
      "properties": {
        "id": "node/2043750839",
        "gid": "openstreetmap:venue:node/2043750839",
        "layer": "venue",
        "source": "openstreetmap",
        "source_id": "node/2043750839",
        "name": "Kurortna",
        "confidence": 1,
        "match_type": "exact",
        "accuracy": "point",
        "country": "Ukraine",
        "country_gid": "whosonfirst:country:85633805",
        "country_a": "UKR",
        "region": "Lviv",
        "region_gid": "whosonfirst:region:85688887",
        "region_a": "LV",
        "county": "L'vivs'ka",
        "county_gid": "whosonfirst:county:1108730647",
        "county_a": "LV",
        "continent": "Europe",
        "continent_gid": "whosonfirst:continent:102191581",
        "label": "Kurortna, LV, Ukraine"
      }
    }
  ],

Steps to Reproduce

Steps to reproduce the behavior:

  1. https://pelias.github.io/compare/#/v1/autocomplete?size=30&boundary.rect.max_lat=49.909829&boundary.rect.max_lon=24.132048&boundary.rect.min_lat=49.757474&boundary.rect.min_lon=23.883483&lang=en&text=%D0%9A%D1%83%D1%80%D0%BE%D1%80%D1%82%D0%BD%D0%B0

Expected behavior

The following request should return the data in https://spelunker.whosonfirst.org/id/101862523/ locality

Pastebin/Screenshots image

Could you guide me on what the problem might be? Happy to contribute if needed

missinglink commented 3 years ago

Hi @ShoSashko, the geometry https://spelunker.whosonfirst.org/id/101862523/ isn't a Polygon, the spelunker map is a little confusing as it shows 101862523 as a green point and the parent 1108730647 as a blue polygon.

curl -s 'https://data.whosonfirst.org/101/862/523/101862523.geojson' | jq .geometry

{
  "coordinates": [
    23.959225,
    49.898366
  ],
  "type": "Point"
}

This module is able to perform point-in-polygon lookups, but it doesn't 'guess' the nearest Point-based geometry, this is a design decision we've made to avoid errors when guessing.

A good fix for this issue would be to replace the point 23.959225, 49.898366 with a Polygon, after the data is fixed all addresses and venues which lie inside that shape will have the correct locality associated.

ShoSashko commented 3 years ago

@missinglink Could you guide me how to fix that? I believe that the appropriate repository is https://github.com/whosonfirst-data/whosonfirst-data-admin-ua

Is that correct?