Closed timautin closed 3 years ago
Addressed in #580.
Hey there :)
I feel like I'm falling in this same trap with this query:
https://photon.komoot.io/api/?q=perpignan&limit=10&lat=43.09120568097367&lon=3.119773864746094
{
"features": [
{
"geometry": {
"coordinates": [
2.9795423,
43.1521322
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_id": 358653396,
"extent": [
2.9792214,
43.1552252,
2.9808017,
43.1514785
],
"country": "France",
"city": "Narbonne",
"countrycode": "FR",
"postcode": "11100",
"locality": "Pech Loubat",
"county": "Aude",
"type": "street",
"osm_type": "W",
"osm_key": "highway",
"osm_value": "primary",
"name": "Route de Perpignan",
"state": "Occitanie"
}
},
{
"geometry": {
"coordinates": [
2.9785523,
43.0287325
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_id": 456166027,
"extent": [
2.9785148,
43.0288032,
2.9785523,
43.0285732
],
"country": "France",
"city": "Sigean",
"countrycode": "FR",
"postcode": "11130",
"county": "Aude",
"type": "street",
"osm_type": "W",
"osm_key": "highway",
"district": "L'Étang Boyé",
"osm_value": "secondary",
"name": "Avenue de Perpignan",
"state": "Occitanie"
}
}
],
"type": "FeatureCollection"
}
The given lat/lng are very close to the French city of Perpignan, but the city is not included in the result. If I remove the lat/lng I have an expected result:
{
"features": [
{
"geometry": {
"coordinates": [
2.8953121,
42.6985304
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 18000,
"extent": [
2.8265889,
42.7488722,
2.9825668,
42.6492606
],
"country": "France",
"osm_key": "place",
"countrycode": "FR",
"osm_value": "city",
"postcode": "66000;66100",
"name": "Perpignan",
"county": "Pyrénées-Orientales",
"state": "Occitanie",
"type": "city"
}
},
{
"geometry": {
"coordinates": [
2.8796929,
42.6962438
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_id": 448465221,
"country": "France",
"city": "Perpignan",
"countrycode": "FR",
"postcode": "66020",
"county": "Pyrénées-Orientales",
"type": "house",
"osm_type": "N",
"osm_key": "railway",
"street": "Place Salvador Dalí",
"district": "La Gare",
"osm_value": "station",
"name": "Perpignan",
"state": "Occitanie"
}
},
{
"geometry": {
"coordinates": [
2.9445625580670858,
42.68012615
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 4487149,
"extent": [
2.8915238,
42.7013338,
2.9838345,
42.6572739
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "political",
"postcode": "66330",
"name": "Perpignan-3",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.8994730962847326,
42.69942655
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 2192061,
"extent": [
2.877617,
42.7055728,
2.9106703,
42.6932515
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "historic",
"name": "Perpignan-2",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.8412817546511633,
42.6803807
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 4487152,
"extent": [
2.7960675,
42.7055728,
2.8997643,
42.655192
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "political",
"name": "Perpignan-6",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.9687832785418133,
42.71502435
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 4487148,
"extent": [
2.8938757,
42.7434542,
3.0406311,
42.6866051
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "political",
"postcode": "66410",
"name": "Perpignan-2",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.9011578070971833,
42.6729183
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 4487150,
"extent": [
2.8809945,
42.6981237,
2.9298058,
42.6492606
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "political",
"name": "Perpignan-4",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.9481693320587032,
42.678303
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 2192062,
"extent": [
2.9038471,
42.6993481,
2.9838345,
42.6572739
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "historic",
"postcode": "66330",
"name": "Perpignan-3",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.948380331195297,
42.7135843
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 2192063,
"extent": [
2.8940321,
42.7405278,
2.9825668,
42.6866051
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "historic",
"postcode": "66430",
"name": "Perpignan-7",
"type": "locality"
}
},
{
"geometry": {
"coordinates": [
2.866997957889401,
42.668408799999995
],
"type": "Point"
},
"type": "Feature",
"properties": {
"osm_type": "R",
"osm_id": 4487151,
"extent": [
2.7986407,
42.6984804,
2.8962101,
42.6384572
],
"country": "France",
"osm_key": "boundary",
"countrycode": "FR",
"osm_value": "political",
"name": "Perpignan-5",
"type": "locality"
}
}
],
"type": "FeatureCollection"
}
(From a bug report in uMap).
Cheers :)
I've added location_bias_scale
to Leaflet.Photon, and started using it in uMap: https://github.com/umap-project/umap/pull/1690 :)
When using location bias, Photon excludes some results that are far to the current location, even if the returned result count is lower than the given limit.
For instance this: https://photon.komoot.de/api/?q=Paris&lang=fr&lat=45.65755848357728&lon=0.15185225754976273&location_bias_scale=6&limit=6 returns only 2 results, without the city of Paris... If I want to get it in the results, I must lower the bias to 1.8, but then I'll be unable to find a nearby restaurant.
This makes the bias useless, making Photon either able to search nearby stuff, or big cities (unless you execute 2 queries). Adding results that do not respect the bias at the end of the array if its count is lower than the limit would help.
PS: I have seen #86 and #59, but they do not seem to have fixed the problem, unless the current release does not include them? If so, please address #427, so that we can compile the latest version.
Thanks!