photo/resources/views/components/map.blade.php

19 lines
668 B
PHP
Raw Permalink Normal View History

2024-09-16 12:10:19 +00:00
<div id="map" class="w-100" style="height: 30em;"></div>
@section('page-scripts')
<script type="text/javascript" src="//unpkg.com/maplibre-gl/dist/maplibre-gl.js"></script>
<link type='text/css' href="//unpkg.com/maplibre-gl/dist/maplibre-gl.css" rel='stylesheet'>
<script type="text/javascript">
var map = new maplibregl.Map({
container: 'map', // container id
style: '/js/maplibre-style.json', // style URL
center: [{{ $o->gps_lon }}, {{ $o->gps_lat }}], // starting position [lng, lat]
zoom: 12 // starting zoom
});
let marker = new maplibregl.Marker()
.setLngLat([{{ $o->gps_lon }}, {{ $o->gps_lat }}])
.addTo(map);
</script>
@append