8000 [Photon] Reverse Geocoding with query filters by ybert · Pull Request #1195 · geocoder-php/Geocoder · GitHub
[go: up one dir, main page]

Skip to content

[Photon] Reverse Geocoding with query filters #1195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Feb 9, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Some documentation about Photon Geocoder
  • Loading branch information
ybert committed Jul 31, 2023
commit 9715af77751ba24a897e2a2d8cd38b3e3e238f1f
41 changes: 37 additions & 4 deletions src/Provider/Photon/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,46 @@
This is the photon provider from the PHP Geocoder. This is a **READ ONLY** repository. See the
[main repo](https://github.com/geocoder-php/Geocoder) for information and documentation.

### Install

## Install
```bash
composer require geocoder-php/photon-provider
```

### Contribute
## API Documentation
https://photon.komoot.io
https://github.com/komoot/photon

## Usage

### Basic usage
You can use your own photon instance :
```php
// New instance of the provider :
$provider = new Geocoder\Provider\Photon\Photon($httpClient, 'https://your-photon-root-url');
// Run geocode or reverse query
$query = $provider->geocodeQuery(new \Geocoder\Query\GeocodeQuery('Paris'));
$reverseQuery = $provider->reverseQuery(\Geocoder\Query\ReverseQuery::fromCoordinates(48.86036 ,2.33852));
```

### OSM Tag Feature
You can search for location data based on osm tag filters.

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'.

In the reverse geocoding context you can search for the 3 pharmacies closest to a location.

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)

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

$results = $provider->reverseQuery($reverseQuery);
```

Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
## Contribute
Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or
report any issues you find on the [issue tracker](https://github.com/geocoder-php/Geocoder/issues).
0