2029
| <![CDATA[<script>
$(window).ready(function () {
// Creating map options
var mapOptions = {
center: [-22.3586, -47.3813],
zoom: 14
}
// Creating a map object
var map = new L.map('mapa', mapOptions);
// Creating a Layer object
var layer = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png');
// Adding layer to the map
map.addLayer(layer);
function carregarNoMapa(nome, endereco, telefone, contato, latitude, longitude, tipo) {
var icone = '../assets/img/content/ponto_hospedagem.png';
if (tipo == 2)
var icone = '../assets/img/content/ponto_taxi.png';
let customIcon = {
iconUrl: icone,
iconSize: [40, 40]
}
let myIcon = L.icon(customIcon);
let iconOptions = {
title: nome,
icon: myIcon
}
// Creating a marker
var marker = L.marker([latitude, longitude], iconOptions);
// Adding marker to the map
marker.addTo(map);
var contentString = '<div id="gmap-content">' +
'<div id="gmap-siteNotice">' +
'</div>' +
'<h3 id="gmap-firstHeading" class="gmap-firstHeading">' + nome + '</h3>' +
'<div id="gmap-bodyContent">' +
'<p><b>Endereço:</b><br>' +
endereco + '<br>' +
'<b>Tel.:</b> ' + telefone + '<br>' +
'<b>Contato:</b> ' + contato + '<br>' +
'</p>' +
'</div>' +
'</div>';
if (contato == null) {
var contentString = '<div id="gmap-content">' +
'<div id="gmap-siteNotice">' +
'</div>' +
'<h3 id="gmap-firstHeading" class="gmap-firstHeading">' + nome + '</h3>' +
'<div id="gmap-bodyContent">' +
'<p><b>Endereço:</b><br>' +
endereco + '<br>' +
'<b>Tel.:</b> ' + telefone + '<br>' +
'</p>' +
'</div>' +
'</div>';
}
marker.bindPopup(contentString);
}
$.getJSON('../hospedagens.json', function (data) {
$.each(data, function (key, val) {
carregarNoMapa(val.nome, val.endereco, val.telefone, val.contato, val.latitude, val.longitude, 1);
});
});
$.getJSON('../pontos_taxi.json', function (data) {
$.each(data, function (key, val) {
carregarNoMapa(val.nome, val.endereco, val.telefone, val.contato, val.latitude, val.longitude, 2);
});
});
});
</script>]]>
|