Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
riverside committed Sep 15, 2024
1 parent a4aa17f commit 9e10e1e
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Next, add the following require entry to the composer.json file in the root of y
```json
{
"require" : {
"riverside/php-nominatim" : "*"
"riverside/php-nominatim" : "^2.0"
}
}
```
Expand All @@ -35,11 +35,11 @@ require __DIR__ . '/vendor/autoload.php';
### Search (geocoding)
Look up a location from a textual description or address.
```php
$client = new \Nominatim\Client();
$client = new \Riverside\Nominatim\Client();
try {
$response = $client->search('Madison Square Garden, NY');
if ($response->isOK()) {
echo $response->getLat() . ", " . $response->getLng();
echo $response->getLat(0) . ", " . $response->getLng(0);
} else {
echo 'Location not found.';
}
Expand All @@ -53,11 +53,11 @@ try {
### Reverse geocoding
Generates an address from a latitude and longitude.
```php
$client = new \Nominatim\Client();
$client = new \Riverside\Nominatim\Client();
try {
$response = $client->reverse(48.8539373, 2.2825966);
if ($response->isOK()) {
echo $response->getAddress();
echo $response->getAddress(0);
} else {
echo 'Address not found';
}
Expand All @@ -71,7 +71,7 @@ try {
### Address lookup
Query the address and other details of one or multiple OSM objects like node, way or relation.
```php
$client = new \Nominatim\Client();
$client = new \Riverside\Nominatim\Client();
try {
$client->setAddressDetails(1);
$response = $client->lookup('R146656,W104393803,N240109189');
Expand All @@ -91,7 +91,7 @@ try {
### Place details
Show all details about a single place saved in the database.
```php
$client = new \Nominatim\Client();
$client = new \Riverside\Nominatim\Client();
try {
$client->setAddressDetails(1);
$response = $client->details(199375150);
Expand All @@ -112,7 +112,7 @@ try {
### Status
Check if the service and database is running, and when the database was last updated.
```php
$client = new \Nominatim\Client();
$client = new \Riverside\Nominatim\Client();
try {
$response = $client->status();
if ($response->isOK())
Expand All @@ -129,6 +129,46 @@ try {
}
```

### Deletable
List objects that have been deleted in OSM but are held back in Nominatim in case the deletion was accidental.
```php
$client = new \Riverside\Nominatim\Client();
try {
$response = $client->deletable();
if ($response->isOK())
{
echo '<pre>';
print_r($response->toArray());
} else {
echo 'Deletable objects not found';
}
} catch (InvalidArgumentException $e) {
echo $e->getMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
```

### Polygons
List of broken polygons detected by Nominatim.
```php
$client = new \Riverside\Nominatim\Client();
try {
$response = $client->polygons();
if ($response->isOK())
{
echo '<pre>';
print_r($response->toArray());
} else {
echo 'Polygons not found';
}
} catch (InvalidArgumentException $e) {
echo $e->getMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
```

### Links
- https://wiki.openstreetmap.org/wiki/Nominatim
- https://github.com/openstreetmap/Nominatim
Expand Down

0 comments on commit 9e10e1e

Please sign in to comment.