Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
46 changes: 46 additions & 0 deletions ToDo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
THE FINAL INTENDED URL Endpoint for Signle POIs (Business Pages)
Make a route that takes a way/node ID + type (similar like the addismap.com URLs)
and loads the data from the openstreetmap.org JSON and displays it
1. Get all Map data (Node/Way/Relation) from OSM using BBOX or Area
2. Generate a JSON data generating URL (End Point) for each Map data
3. Get a JSON Response using OSM_TYPE & OSM_ID obtained from OSM_OVERPASS_API {Elements}

Get URL https://www.addismap.com/p6624545638/bati-complex
Get URL https://openplaceguide.org/{name}
Get URL https://openplaceguide.org/{osm_type}{osm_id}/{osm_name}
Get URL https://openplaceguide.org/{osm_type}/{osm_id} -> desired URL (Endpoint)
Get URL https://www.openstreetmap.org/api/0.6/way/162817836.json


date=`date +%FT%H-%M-%S`
#XAPI="http://xapi.openstreetmap.org/api/0.6/map"
XAPI="http://www.overpass-api.de/api/xapi?map"
## ETHIOPIA via Geofabrik
URL=http://download.geofabrik.de/openstreetmap/africa/ethiopia.osm.bz2
dir=/srv/downloads/osm/ethiopia
name="ethiopia"
wget $URL -O $dir/$date-$name.osm.bz2
## ETHIOPIA via Geofabrik
URL=http://download.geofabrik.de/openstreetmap/africa/ethiopia.osm.pbf
dir=/srv/downloads/osm/ethiopia
name="ethiopia"
wget $URL -O $dir/$date-$name.osm.pbf
## Addis via XAPI
dir=/srv/downloads/osm/addis-ababa
name="addis-ababa"
top=9.13
bottom=8.8
left=38.61
right=38.96
URL=$XAPI?bbox=$left,$bottom,$right,$top
wget $URL -O $dir/$date-$name.osm
bzip2 $dir/$date-$name.osm
/srv/bame-website/scripts/new-osm.sh $dir/$date-$name.osm.bz2
#XAPI="http://xapi.openstreetmap.org/api/0.6"
#top=14.8922
#bottom=3.4024
#left=32.9999
#right=47.9862
#URL=$XAPI/map?bbox=$left,$bottom,$right,$top


12 changes: 8 additions & 4 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
use LaravelJsonApi\Core\Exceptions\JsonApiException;

class Handler extends ExceptionHandler
{
Expand All @@ -13,7 +14,7 @@ class Handler extends ExceptionHandler
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
JsonApiException::class,
];

/**
Expand All @@ -34,8 +35,11 @@ class Handler extends ExceptionHandler
*/
public function register()
{
$this->reportable(function (Throwable $e) {
//
});
// $this->reportable(function (Throwable $e) {
// //
// });
$this->renderable(
\LaravelJsonApi\Exceptions\ExceptionParser::make()->renderable()
);
}
}
27 changes: 27 additions & 0 deletions app/Http/Controllers/OsmapController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;

use App\Models\Osmap;

class OsmapController extends Controller
{
public function index()
{
$query = '[out:json][timeout:400];nwr["name"](8.827402638625081,38.63822937011719,9.104808725563043,38.91632080078125);out%20body;';

$osmaps = collect(Http::get('https://www.overpass-api.de/api/map?data='.$query)->json()['elements']);

return view('osmaps.index', ['osmaps' => $osmaps]);
}

public function show($type, $id)
{
$osmurl = Http::get('https://www.openstreetmap.org/api/0.6/'.$type.'/'.$id.'.json');
return $osmurl;
}
}

2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel-json-api/laravel": "^2.3",
"laravel/framework": "^9.2",
"laravel/sanctum": "^2.14.1",
"laravel/tinker": "^2.7"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel-json-api/testing": "^1.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^6.1",
Expand Down
Loading