pelias / pelias/api

Results not ordered by confidence / distance in reverseGeocode

Open
#1,500 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
259
Forks
168
Avg merge
6h 15m
Merged PRs (30d)
1

Description

Describe the bug

I have found a case where the first reverseGeocode result in the list is further away and with a lower confidence value than the second one.

Steps to Reproduce

https://pelias.github.io/compare/#/v1/reverse?boundary.circle.radius=0.1&size=5&lang=en&point.lat=58.380367&point.lon=26.706314

Expected behavior

I would expect the second result to come before the first one

Pastebin/Screenshots

Result:

{
	"geocoding": {
		"version": "0.2",
		"attribution": "https://geocode.earth/guidelines",
		"query": {
			"size": 5,
			"private": false,
			"point.lat": 58.380367,
			"point.lon": 26.706314,
			"boundary.circle.radius": 0.1,
			"boundary.circle.lat": 58.380367,
			"boundary.circle.lon": 26.706314,
			"lang": {
				"name": "English",
				"iso6391": "en",
				"iso6393": "eng",
				"via": "querystring",
				"defaulted": false
			},
			"querySize": 10
		},
		"engine": {
			"name": "Pelias",
			"author": "Mapzen",
			"version": "1.0"
		},
		"timestamp": 1603884225559
	},
	"type": "FeatureCollection",
	"features": [{
			"type": "Feature",
			"geometry": {
				"type": "Point",
				"coordinates": [
					26.706578,
					58.380287
				]
			},
			"properties": {
				"id": "way/30223056",
				"gid": "openstreetmap:address:way/30223056",
				"layer": "address",
				"source": "openstreetmap",
				"source_id": "way/30223056",
				"name": "3 Taara pst",
				"housenumber": "3",
				"street": "Taara pst",
				"postalcode": "51005",
				"confidence": 0.8,
				"distance": 0.018,
				"accuracy": "point",
				"country": "Estonia",
				"country_gid": "whosonfirst:country:85633135",
				"country_a": "EST",
				"region": "Tartu",
				"region_gid": "whosonfirst:region:85682995",
				"region_a": "TA",
				"county": "Tartu",
				"county_gid": "whosonfirst:county:1713305675",
				"localadmin": "Tartu",
				"localadmin_gid": "whosonfirst:localadmin:1713314027",
				"locality": "Tartu",
				"locality_gid": "whosonfirst:locality:101748151",
				"continent": "Europe",
				"continent_gid": "whosonfirst:continent:102191581",
				"label": "3 Taara pst, Tartu, Estonia",
				"index": 0
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Point",
				"coordinates": [
					26.706223,
					58.380417
				]
			},
			"properties": {
				"id": "ee/countrywide:8e62ef656c312bf8",
				"gid": "openaddresses:address:ee/countrywide:8e62ef656c312bf8",
				"layer": "address",
				"source": "openaddresses",
				"source_id": "ee/countrywide:8e62ef656c312bf8",
				"name": "5 Taara Puiestee",
				"housenumber": "5",
				"street": "Taara Puiestee",
				"confidence": 0.9,
				"distance": 0.008,
				"accuracy": "point",
				"country": "Estonia",
				"country_gid": "whosonfirst:country:85633135",
				"country_a": "EST",
				"region": "Tartu",
				"region_gid": "whosonfirst:region:85682995",
				"region_a": "TA",
				"county": "Tartu",
				"county_gid": "whosonfirst:county:1713305675",
				"localadmin": "Tartu",
				"localadmin_gid": "whosonfirst:localadmin:1713314027",
				"locality": "Tartu",
				"locality_gid": "whosonfirst:locality:101748151",
				"continent": "Europe",
				"continent_gid": "whosonfirst:continent:102191581",
				"label": "5 Taara Puiestee, Tartu, Estonia",
				"index": 1
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Point",
				"coordinates": [
					26.706215,
					58.380424
				]
			},
			"properties": {
				"id": "way/30231577",
				"gid": "openstreetmap:address:way/30231577",
				"layer": "address",
				"source": "openstreetmap",
				"source_id": "way/30231577",
				"name": "5 Taara pst",
				"housenumber": "5",
				"street": "Taara pst",
				"postalcode": "51005",
				"confidence": 0.9,
				"distance": 0.009,
				"accuracy": "point",
				"country": "Estonia",
				"country_gid": "whosonfirst:country:85633135",
				"country_a": "EST",
				"region": "Tartu",
				"region_gid": "whosonfirst:region:85682995",
				"region_a": "TA",
				"county": "Tartu",
				"county_gid": "whosonfirst:county:1713305675",
				"localadmin": "Tartu",
				"localadmin_gid": "whosonfirst:localadmin:1713314027",
				"locality": "Tartu",
				"locality_gid": "whosonfirst:locality:101748151",
				"continent": "Europe",
				"continent_gid": "whosonfirst:continent:102191581",
				"label": "5 Taara pst, Tartu, Estonia",
				"index": 2
			}
		},
		{
			"type": "Feature",
			"geometry": {
				"type": "Point",
				"coordinates": [
					26.706606,
					58.380273
				]
			},
			"properties": {
				"id": "ee/countrywide:2c8f15eedfb55b02",
				"gid": "openaddresses:address:ee/countrywide:2c8f15eedfb55b02",
				"layer": "address",
				"source": "openaddresses",
				"source_id": "ee/countrywide:2c8f15eedfb55b02",
				"name": "3 Taara Puiestee",
				"housenumber": "3",
				"street": "Taara Puiestee",
				"confidence": 0.8,
				"distance": 0.02,
				"accuracy": "point",
				"country": "Estonia",
				"country_gid": "whosonfirst:country:85633135",
				"country_a": "EST",
				"region": "Tartu",
				"region_gid": "whosonfirst:region:85682995",
				"region_a": "TA",
				"county": "Tartu",
				"county_gid": "whosonfirst:county:1713305675",
				"localadmin": "Tartu",
				"localadmin_gid": "whosonfirst:localadmin:1713314027",
				"locality": "Tartu",
				"locality_gid": "whosonfirst:locality:101748151",
				"continent": "Europe",
				"continent_gid": "whosonfirst:continent:102191581",
				"label": "3 Taara Puiestee, Tartu, Estonia",
				"index": 3
			}
		}
	],
	"bbox": [
		26.706215,
		58.380273,
		26.706606,
		58.380424
	]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the linked reverseGeocode request and inspect how the API orders its returned features. Compare the confidence and distance values in the response with their positions in the list. Done means the results are ordered consistently with the expected confidence or distance ranking, with a regression test covering this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.