I'm trying to obtain an image from my json file and I want to display it on the map.
This is what the Json looks like:
{
"type": "Feature",
"id": 0,
"properties": {
"NAME": "Building",
"FLOOR_IMG_1": "assets/img/floor-plan1.svg",
"FLOOR_IMG_2": "assets/img/floor-plan2.svg"
},
"geometry": {
"type": "Point",
"coordinates": [100, 10]
}
}
I want to display the "FLOOR_IMG_1" and "FLOOR_IMG_2".
I tried this code but it's not working
$.getJSON("data/building.geojson", function (data) {
var imageUrl = feature.properties.FLOOR_IMG_1,
imageBounds = [
[0, 0],
[250, 250],
];
image = L.imageOverlay(imageUrl, imageBounds).addTo(map);
map.fitBounds(imageBounds);
});
Add jQuery, $.getJSON is jQuery method
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>