Constrain map Zoom and bounds

This commit is contained in:
Chandler Swift 2025-01-02 22:08:40 -06:00
parent 4533956902
commit fb1ad615d0
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -63,7 +63,14 @@
<div id="popupcontainer" class="leaflet-container"></div> <div id="popupcontainer" class="leaflet-container"></div>
<script> <script>
(async function() { (async function() {
const map = L.map('map').setView([94.505, -0.09], 13); const map = L.map('map', {
minZoom: 12,
maxZoom: 21,
maxBounds: [
[47.517085, -93.427584],
[47.457925, -93.340026],
],
}).setView([94.505, -0.09], 13);
// L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { // L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
// maxZoom: 19, // maxZoom: 19,
// attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' // attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'