-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExibir Mapa do Google
33 lines (27 loc) · 1.03 KB
/
Exibir Mapa do Google
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<head>
<style>
#map {
width: 100%;
height: 800px;
}
</style>
</head>
// BODY
<div id="map"></div>
// SCRIPT
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script>
var brazilCoordinates = [-10.650943, -53.179219]; // Coordenadas para o centro do Brasil
var initialZoom = 4; // Zoom para exibir todo o Brasil
var map = L.map('map').setView(brazilCoordinates, initialZoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© OpenStreetMap contributors'
}).addTo(map);
var mapPoints = @Html.Raw(Json.Serialize(Model));
mapPoints.forEach(function (point) {
var marker = L.marker([point.latitude, point.longitude]).addTo(map);
marker.bindPopup("<strong>" + point.title + "</strong><br>" + point.description).openPopup();
});
</script>