function showLocation(){
var lastLat = null;
var lastLng = null;
var somaArea = 0;
var somaLat = 0;
var somaLng = 0;
var properties = null;
if(typeof this._layers == "undefined"){
var lat = this._latlng.lat;
var lng = this._latlng.lng;
properties = $.parseJSON(this.options.alt);
}else{
$.each(this._layers, function(){
if(this.feature.geometry.type == "LineString"){
$.each(this._latlngs, function(){
if(typeof lastLat == "number"){
somaArea += (lastLat * this.lng) - (this.lat * lastLng);
somaLat += (lastLat + this.lat) * ((lastLat * this.lng) - (this.lat * lastLng));
somaLng += (lastLng + this.lng) * ((lastLat * this.lng) - (this.lat * lastLng));
}
lastLat = this.lat;
lastLng = this.lng;
});
somaArea += (lastLat * this._latlngs[0].lng) - (this._latlngs[0].lat * lastLng);
somaLat += (lastLat + this._latlngs[0].lat) * ((lastLat * this._latlngs[0].lng) - (this._latlngs[0].lat * lastLng));
somaLng += (lastLng + this._latlngs[0].lng) * ((lastLat * this._latlngs[0].lng) - (this._latlngs[0].lat * lastLng));
}else{
$.each(this._latlngs[0], function(){
if(typeof lastLat == "number"){
somaArea += (lastLat * this.lng) - (this.lat * lastLng);
somaLat += (lastLat + this.lat) * ((lastLat * this.lng) - (this.lat * lastLng));
somaLng += (lastLng + this.lng) * ((lastLat * this.lng) - (this.lat * lastLng));
}
lastLat = this.lat;
lastLng = this.lng;
});
somaArea += (lastLat * this._latlngs[0][0].lng) - (this._latlngs[0][0].lat * lastLng);
somaLat += (lastLat + this._latlngs[0][0].lat) * ((lastLat * this._latlngs[0][0].lng) - (this._latlngs[0][0].lat * lastLng));
somaLng += (lastLng + this._latlngs[0][0].lng) * ((lastLat * this._latlngs[0][0].lng) - (this._latlngs[0][0].lat * lastLng));
}
properties = this.feature.properties;
});
var area = somaArea/2;
var lat = somaLat/(6 * area);
var lng = somaLng/(6 * area);
}
$("#info-text").fadeOut("fast", function(){
minimap.panTo(new L.LatLng(lat, lng));
minimap.eachLayer(function(layer){
if(layer["_url"] == undefined){
minimap.removeLayer(layer);
}
});
var miniMarker = L.marker([lat, lng], {icon:marker[1]}).addTo(minimap);
var description = properties.Descricao.replace(" - ", "
").replace(" - ", "
").replace(" – ", "
").replace(" - ", "
");
$("#location-titulo").html(properties.Titulo);
$("#location-tipo").html(properties.Tipo);
$("#location-descricao").html(description);
if(typeof properties.Link != "undefined"){
$("#location-link").css({"display":""}).attr("href", properties.Link);
}else{
$("#location-link").css({"display":"none"});
}
$("#info-corona").css({"display":"none"});
$("#info-text").fadeIn("normal", function(){
minimap.invalidateSize(true);
});
});
if(properties.Titulo == "Quadras da Cidade" && properties.Tipo == "Localização de Imóveis"){
var thisLayer = this;
var loteDados = $.parseJSON(properties.Dados);
var mData = {};
mData.lotes = [];
mData.lotes[0] = {};
mData.lotes[0].bairro = loteDados.BAIRRO;
mData.lotes[0].quadra = loteDados.TEXTSTRING;
var mJson = JSON.stringify(mData);
request = new XMLHttpRequest();
request.open("POST", "https://semecmaceio.com/v1/integracao/polygon", true);
request.setRequestHeader("Content-type", "application/json");
request.send(mJson);
request.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
var WSJson = $.parseJSON(this.responseText);
if(typeof WSJson.erro == "undefined"){
$.getJSON(dir + "json/tipos.php", function(tipos){
var key = Object.keys(tipos).find(key => tipos[key]["texto"] === "Localização de Imóveis");
$.each(WSJson.features, function(b){
WSJson.features[b].properties.Titulo = "Lotes da Cidade";
WSJson.features[b].properties.Tipo = "Localização de Imóveis";
var logradouro = (typeof WSJson.features[b].properties.LOGRADOURO == "string" && WSJson.features[b].properties.LOGRADOURO != "") ? ("
Logradouro: " + WSJson.features[b].properties.LOGRADOURO) : "";
var numero = (typeof WSJson.features[b].properties.NUMERO == "string") ? ("
Número: " + WSJson.features[b].properties.NUMERO) : "";
WSJson.features[b].properties.Descricao = "Setor: " + parseInt(WSJson.features[b].properties.SETOR) + "
Quadra: " + parseInt(WSJson.features[b].properties.QUADRA) + "
Lote: " + parseInt(WSJson.features[b].properties.LOTE) + "
Zona: " + WSJson.features[b].properties.ZONEAMENTO + "
Bairro: " + WSJson.features[b].properties.PATH + logradouro + numero + "