mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
osm data
This commit is contained in:
@@ -14,6 +14,7 @@ class PrepareForBtcMapItem extends Component
|
|||||||
public $wikipediaSearchResults;
|
public $wikipediaSearchResults;
|
||||||
public $osmSearchResults;
|
public $osmSearchResults;
|
||||||
public $osmSearchResultsState;
|
public $osmSearchResultsState;
|
||||||
|
public $osmSearchResultsCountry;
|
||||||
|
|
||||||
public $selectedItem;
|
public $selectedItem;
|
||||||
|
|
||||||
@@ -31,6 +32,12 @@ class PrepareForBtcMapItem extends Component
|
|||||||
);
|
);
|
||||||
$this->osmSearchResultsState = $response->json();
|
$this->osmSearchResultsState = $response->json();
|
||||||
|
|
||||||
|
$response = Http::acceptJson()
|
||||||
|
->get(
|
||||||
|
'https://nominatim.openstreetmap.org/search?country='.$this->meetup->city->name.'&format=json&polygon_geojson=1'
|
||||||
|
);
|
||||||
|
$this->osmSearchResultsCountry = $response->json();
|
||||||
|
|
||||||
if ($this->meetup->city->osm_relation) {
|
if ($this->meetup->city->osm_relation) {
|
||||||
$this->selectedItem = $this->meetup->city->osm_relation;
|
$this->selectedItem = $this->meetup->city->osm_relation;
|
||||||
|
|
||||||
@@ -43,10 +50,12 @@ class PrepareForBtcMapItem extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function selectItem($index, bool $isState = false)
|
public function selectItem($index, bool $isState = false, $isCountry = false)
|
||||||
{
|
{
|
||||||
if ($isState) {
|
if ($isState) {
|
||||||
$this->selectedItem = $this->osmSearchResultsState[$index];
|
$this->selectedItem = $this->osmSearchResultsState[$index];
|
||||||
|
} elseif ($isCountry) {
|
||||||
|
$this->selectedItem = $this->osmSearchResultsCountry[$index];
|
||||||
} else {
|
} else {
|
||||||
$this->selectedItem = $this->osmSearchResults[$index];
|
$this->selectedItem = $this->osmSearchResults[$index];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,15 @@
|
|||||||
|
|
||||||
<div class="max-w-none text-white flex flex-col space-y-4">
|
<div class="max-w-none text-white flex flex-col space-y-4">
|
||||||
<a href="{{ route('osm.meetups') }}">Zurück</a>
|
<a href="{{ route('osm.meetups') }}">Zurück</a>
|
||||||
<div class="grid grid-cols-2 gap-2">
|
<div class="grid grid-cols-3 gap-2">
|
||||||
<div>
|
<div>
|
||||||
<h1>Search city: {{ $meetup->city->name }}</h1>
|
<h1>Search city: {{ $meetup->city->name }}</h1>
|
||||||
<h1>OSM API Response</h1>
|
<h1>OSM API Response</h1>
|
||||||
<div class="flex flex-col space-y-2">
|
<div class="flex flex-col space-y-2">
|
||||||
@foreach($osmSearchResults as $item)
|
@foreach($osmSearchResults as $item)
|
||||||
<code class="w-full">
|
<code class="w-full">
|
||||||
<div wire:key="osmItemCity_{{ $loop->index }}" class="cursor-pointer underline" wire:click="selectItem({{ $loop->index }})">
|
<div wire:key="osmItemCity_{{ $loop->index }}" class="cursor-pointer underline"
|
||||||
|
wire:click="selectItem({{ $loop->index }})">
|
||||||
{{ $item['display_name'] }}
|
{{ $item['display_name'] }}
|
||||||
</div>
|
</div>
|
||||||
</code>
|
</code>
|
||||||
@@ -22,7 +23,22 @@
|
|||||||
<div class="flex flex-col space-y-2">
|
<div class="flex flex-col space-y-2">
|
||||||
@foreach($osmSearchResultsState as $item)
|
@foreach($osmSearchResultsState as $item)
|
||||||
<code class="w-full">
|
<code class="w-full">
|
||||||
<div wire:key="osmItemState_{{ $loop->index }}" class="cursor-pointer underline" wire:click="selectItem({{ $loop->index }}, true)">
|
<div wire:key="osmItemState_{{ $loop->index }}" class="cursor-pointer underline"
|
||||||
|
wire:click="selectItem({{ $loop->index }}, true)">
|
||||||
|
{{ $item['display_name'] }}
|
||||||
|
</div>
|
||||||
|
</code>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h1>Search country: {{ $meetup->city->name }}</h1>
|
||||||
|
<h1>OSM API Response</h1>
|
||||||
|
<div class="flex flex-col space-y-2">
|
||||||
|
@foreach($osmSearchResultsCountry as $item)
|
||||||
|
<code class="w-full">
|
||||||
|
<div wire:key="osmItemCountry_{{ $loop->index }}" class="cursor-pointer underline"
|
||||||
|
wire:click="selectItem({{ $loop->index }}, false, true)">
|
||||||
{{ $item['display_name'] }}
|
{{ $item['display_name'] }}
|
||||||
</div>
|
</div>
|
||||||
</code>
|
</code>
|
||||||
@@ -88,7 +104,8 @@
|
|||||||
<h1>Wikipedia Search Results</h1>
|
<h1>Wikipedia Search Results</h1>
|
||||||
<div class="flex space-x-2">
|
<div class="flex space-x-2">
|
||||||
@foreach($wikipediaSearchResults['results']['bindings'] ?? [] as $pop)
|
@foreach($wikipediaSearchResults['results']['bindings'] ?? [] as $pop)
|
||||||
<div wire:key="pop_{{ $loop->index }}" class="cursor-pointer underline font-bold" wire:click="takePop({{ $pop['population']['value'] }})">
|
<div wire:key="pop_{{ $loop->index }}" class="cursor-pointer underline font-bold"
|
||||||
|
wire:click="takePop({{ $pop['population']['value'] }})">
|
||||||
population: {{ number_format($pop['population']['value']) }}
|
population: {{ number_format($pop['population']['value']) }}
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|||||||
Reference in New Issue
Block a user