Skip to content

Commit 0c4180a

Browse files
committed
More documentation about multiple osm tag filters
1 parent 4b17592 commit 0c4180a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Provider/Photon/Readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,31 @@ $reverseQuery = $provider->reverseQuery(\Geocoder\Query\ReverseQuery::fromCoordi
3535
You can search for location data based on osm tag filters.
3636

3737
For example, you can filter a geocode query to only include results of type 'place'. You can even restrict it to only have places of type 'city'.
38-
3938
In the reverse geocoding context you can search for the 3 pharmacies closest to a location.
4039

4140
To see what you can do with this feature, check [the official photon documentation](https://github.com/komoot/photon#filter-results-by-tags-and-values)
4241

4342
Below is an example to query the 3 pharmacies closest to a location :
4443
```php
4544
$provider = new Geocoder\Provider\Photon\Photon($httpClient, 'https://your-photon-root-url');
46-
$reverseQuery = ReverseQuery::fromCoordinates(52.51644, 13.38890)
45+
$reverseQuery = \Geocoder\Query\ReverseQuery::fromCoordinates(52.51644, 13.38890)
4746
->withData('osm_tag', 'amenity:pharmacy')
4847
->withLimit(3);
4948

5049
$results = $provider->reverseQuery($reverseQuery);
5150
```
5251

52+
You can combine multiple osm tag filters :
53+
```php
54+
$provider = new Geocoder\Provider\Photon\Photon($httpClient, 'https://your-photon-root-url');
55+
$reverseQuery = \Geocoder\Query\GeocodeQuery::create('Paris')
56+
->withData('osm_tag', ['tourism', ':!museum'])
57+
->withLimit(5);
58+
// Here we get 5 tourism results in Paris which are not museums
59+
$results = $provider->reverseQuery($reverseQuery);
60+
```
61+
62+
5363
## Contribute
5464
Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
5565
report any issues you find on the [issue tracker](https://github.com/geocoder-php/Geocoder/issues).

0 commit comments

Comments
 (0)