'; } infoWindow.setContent(content); }).catch( (error) => { if(error.response.status == 404) { smot.fileFetched = true; deixe locationString = ''; if(smot.street) { locationString += smot.street; if(smot.city) { locationString += ', '; } } if(smot.city) { locationString += smot.city + ' '; } locationString += smot.zipCode ?? ''; var content = '
'; } infoWindow.setContent(content); } ); } function calculateMapCenter(coords) { if (coords.length === 1) { return coords[0]; } deixe x = 0.0; deixe y = 0.0; deixe z = 0.0; deixe length = 0; for (const coord of coords) { if (coord.lat() !== 0 && coord.lng() !== 0) { length += 1; const latitude = coord.lat() * Math.PI / 180; const longitude = coord.lng() * Math.PI / 180; x += Math.cos(latitude) * Math.cos(longitude); y += Math.cos(latitude) * Math.sin(longitude); z += Math.sin(latitude); } } const total = length; x = x / total; y = y / total; z = z / total; const LongitudeCentral = Math. atan2(y, x); const RaizQuadradaCentral = Math. sqrt(x * x + y * y); const LatitudeCentral = Math. atan2(z, RaizQuadradaCentral); return { lat: LatitudeCentral * 180 / Math. PI, lng: LongitudeCentral * 180 / Math. PI }; }