geocoder-php / geocoder-php/Geocoder
Mapbox Provider prevents searching for countries
Nessuno ha ancora preso questa issue.
- Lingua principale
- PHP
- Stelle
- 4k
- Fork
- 525
- Merge medio
- 8m
- PR unite (30g)
- 1
Descrizione
I'm using the Mapbox Provider in my API to fetch coordinates for given entities. These entities can be either:
- Countries
- Cities
- Districts
- Addresses
However, the current implementation of the mapbox provider prevents from returning anything that doesn't contain a context.
When I run this snippet and watch the console, I see that the query to Mapbox is correct and data is returned.
$locations = $mapboxGeocoder->geocodeQuery(
GeocodeQuery::create($country->getName())
->withLocale('nl')
->withData('location_type', 'country')
);
However, the fetchUrl method in Mapbox.php simply breaks when a result without context is returned by Mapbox.
https://github.com/geocoder-php/mapbox-provider/blob/master/Mapbox.php#L283
When I remove that piece of code, and add an additional check here to check if context is available before iterating through it, the code returns the requested items.
https://github.com/geocoder-php/mapbox-provider/blob/master/Mapbox.php#L301
This isn't a clean solution and additional models are required to make it a better implementation. However, the repo is read-only so I cannot help with the required changes
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Esamina Mapbox.php intorno alle righe 283 e 301, iniziando da fetchUrl e dalla gestione dei risultati Mapbox senza un campo context. Traccia i modelli esistenti utilizzati per i dati di context e verifica che i risultati dei paesi vengano restituiti senza interrompere il funzionamento, mentre città, distretti e indirizzi mantengono il comportamento esistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100