1. Go to this page and download the library: Download kage-no-neko/osm library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kage-no-neko / osm example snippets
$south = 47.27021;
$west = 5.86624;
$north = 55.05814;
$east = 15.04205;
// create bounding box
$bBox = new \KageNoNeko\OSM\BoundingBox($south, $west, $north, $east);
// slice to lesser boxes to reduce memory usage
$slices = $bBox->slices(4, 4);
// create connection to Overpass API source
$osm = new \KageNoNeko\OSM\OverpassConnection(['interpreter' => 'http://overpass-api.de/api/interpreter']);
// build query, like we usually do with Database queries
$q = $osm->element('node')
->whereTag('aeroway', 'aerodrome')
->verbosity('meta')
->asJson();
$nodes = [];
foreach ($slices as $slice) {
//add constraint by boundary box of each slice and get result
$response = $q->whereInBBox($slice)->get();
$data = json_decode($response->getBody()->getContents());
$nodes = array_merge($nodes, $data->elements);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.