activitypods icon indicating copy to clipboard operation
activitypods copied to clipboard

Replace MapBox with a token-less provider

Open srosset81 opened this issue 1 year ago • 8 comments

This is too much hassle to require developers to register with MapBox only to test a local Pod provider.

Here is a list of alternatives: https://github.com/alexreisner/geocoder/blob/master/README_API_GUIDE.md

Here are 2 token-less alternatives from this guide: https://wiki.openstreetmap.org/wiki/Nominatim (limited to one request/second) https://photon.komoot.io/

srosset81 avatar Sep 03 '24 15:09 srosset81

First tests:

  • Photon works well but queries take over 10s
  • Nominatim works well, results in less than 1s

Example request

https://nominatim.openstreetmap.org/search?q=140%20bd%20etats-unis%20compi%C3%A8gne&format=geojson&addressdetails=1&countrycodes=fr,ch,be,lu

{
	"type": "FeatureCollection",
	"licence": "Data © OpenStreetMap contributors, ODbL 1.0. http://osm.org/copyright",
	"features": [
		{
			"type": "Feature",
			"properties": {
				"place_id": 118137520,
				"osm_type": "way",
				"osm_id": 105281591,
				"place_rank": 26,
				"category": "highway",
				"type": "tertiary",
				"importance": 0.05340258258945598,
				"addresstype": "road",
				"name": "Boulevard des États-Unis",
				"display_name": "Boulevard des États-Unis, Les Sablons, Compiègne, Oise, Hauts-de-France, France métropolitaine, 60200, France",
				"address": {
					"road": "Boulevard des États-Unis",
					"suburb": "Les Sablons",
					"town": "Compiègne",
					"municipality": "Compiègne",
					"county": "Oise",
					"ISO3166-2-lvl6": "FR-60",
					"state": "Hauts-de-France",
					"ISO3166-2-lvl4": "FR-HDF",
					"region": "France métropolitaine",
					"postcode": "60200",
					"country": "France",
					"country_code": "fr"
				}
			},
			"bbox": [
				2.8172043,
				49.4091308,
				2.8199261,
				49.4105836
			],
			"geometry": {
				"type": "Point",
				"coordinates": [
					2.8181805,
					49.4100626
				]
			}
		},
		{
			"type": "Feature",
			"properties": {
				"place_id": 117021383,
				"osm_type": "way",
				"osm_id": 262640244,
				"place_rank": 26,
				"category": "highway",
				"type": "tertiary",
				"importance": 0.05340258258945598,
				"addresstype": "road",
				"name": "Boulevard des États-Unis",
				"display_name": "Boulevard des États-Unis, Les Avenues, Saint-Lazare - Les Avenues, Compiègne, Oise, Hauts-de-France, France métropolitaine, 60200, France",
				"address": {
					"road": "Boulevard des États-Unis",
					"neighbourhood": "Les Avenues",
					"suburb": "Saint-Lazare - Les Avenues",
					"town": "Compiègne",
					"municipality": "Compiègne",
					"county": "Oise",
					"ISO3166-2-lvl6": "FR-60",
					"state": "Hauts-de-France",
					"ISO3166-2-lvl4": "FR-HDF",
					"region": "France métropolitaine",
					"postcode": "60200",
					"country": "France",
					"country_code": "fr"
				}
			},
			"bbox": [
				2.8330911,
				49.4059422,
				2.8359391,
				49.4064353
			],
			"geometry": {
				"type": "Point",
				"coordinates": [
					2.8344556,
					49.4061772
				]
			}
		}
	]
}

srosset81 avatar Sep 04 '24 13:09 srosset81

Nominatim TOS says it does not accept auto-complete features, so we may get banned.

An alternative could be to host our own Nominatim instance: https://github.com/mediagis/nominatim-docker

Photon also has a Docker image but it's 60Gb: https://github.com/tonsnoei/photon-docker

srosset81 avatar Sep 04 '24 14:09 srosset81

Would this service only be needed for development or would it be used in production?

simonLouvet avatar Sep 05 '24 07:09 simonLouvet

@simonLouvet Mainly for development I think. For production it will be better to get a MapBox token.

srosset81 avatar Sep 05 '24 13:09 srosset81

That means a call to a specific service (and the dev to get there) only for development :-/ not convinced but I understand the need Maybe a mock?

simonLouvet avatar Sep 06 '24 19:09 simonLouvet

This is a ActivityPods issue. It is a big pain when you want to setup a local Pod provider.

srosset81 avatar Sep 10 '24 22:09 srosset81

I didn't want to interfere with the project. I had indeed misread the repository

simonLouvet avatar Sep 16 '24 11:09 simonLouvet

One solution could be to hide the address input if no mapbox token is provided

srosset81 avatar Sep 17 '24 07:09 srosset81

Fully in favor in hiding the address input

This should be a cool optional add-on and not a required feature

thhck avatar Mar 08 '25 12:03 thhck

Hi @thhck I had forgotten to close this issue, but this change been done here: the docs don't mention MapBox anymore :)

srosset81 avatar Mar 10 '25 08:03 srosset81