arreglar mapa

This commit is contained in:
Cat /dev/Nulo 2024-09-14 18:04:43 -03:00
parent 9aff44b3d9
commit 4b2c360e17
2 changed files with 7 additions and 7 deletions

View file

@ -2,25 +2,24 @@
import { onDestroy, onMount, tick } from 'svelte';
import 'leaflet/dist/leaflet.css';
import style from './map_style.json';
import type L from 'leaflet';
import L from 'leaflet';
import 'maplibre-gl';
import '@maplibre/maplibre-gl-leaflet';
let mapEl: HTMLDivElement;
export let mapMap: (map: L.Map, l: typeof L) => void;
let map: L.Map | undefined;
onMount(async () => {
window.L = await import('leaflet');
const L2 = await import('maplibre-gl');
const L3 = await import('@maplibre/maplibre-gl-leaflet');
// Set up initial map center and zoom level
map = window.L.map(mapEl, {
map = L.map(mapEl, {
center: [-34.599722222222, -58.381944444444], // EDIT latitude, longitude to re-center map
zoom: 9, // EDIT from 1 to 18 -- decrease to zoom out, increase to zoom in
scrollWheelZoom: true // Changed to true to enable zoom with scrollwheel
// tap: false
});
window.L.maplibreGL({
L.maplibreGL({
style: style as any,
attribution:
'&copy; <a href="https://stadiamaps.com/" target="_blank">Stadia Maps</a>, &copy; <a href="https://openmaptiles.org/" target="_blank">OpenMapTiles</a> &copy; <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>'
@ -28,7 +27,7 @@
// display Carto basemap tiles with light features and labels
// L.tileLayer.provider('Stadia.AlidadeSmoothBackground').addTo(map);
mapMap(map, window.L);
mapMap(map, L);
});
onDestroy(() => {

View file

@ -0,0 +1 @@
export const ssr = false;