leaflet iimage map find center of random iamges

22 Views Asked by At

I use a method to create a leaflet map with images. I want these images to fit correct to the map. How can i do that? Images have different sizes

getImageMap(backgroundUrl: string) {
    let map = null;
    map = L.map('map', {
        maxZoom: 1,
        minZoom: 1,
        crs: L.CRS.Simple,
        doubleClickZoom: false,
    }).setView([0, 0], 1);
    map.setMaxBounds(new L.LatLngBounds([0, 500], [500, 0]));
    let imageBounds: [number, number][] = [
        [0, 0],
        [312, 512],
    ];
    L.imageOverlay(backgroundUrl, imageBounds).addTo(map);
    return map;
}
0

There are 0 best solutions below