geocoder-php / geocoder-php/Geocoder
Mapbox Provider prevents searching for countries
まだ誰も着手していません。
- 主要言語
- PHP
- スター
- 4k
- フォーク
- 525
- 平均マージ
- 8分
- マージ済み PR(30日)
- 1
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
283行目と301行目付近のMapbox.phpを確認し、fetchUrlとcontextフィールドを持たないMapbox結果の処理から始めます。contextデータに使用されている既存のモデルを追跡し、都市、地区、住所が既存の動作を維持したまま、国の結果が問題なく返されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- php
- 領域
- api, backend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100