#map_wp-buildingmap-2 { height:350px; }
@media (min-width: 768px) { #map { height:200px; } }
@media (min-width: 992px) { #map { height:250px; } }
@media (min-width: 1200px) { #map { height:300px; } }
$( document ).ready(
function () {
// Create a map object and specify the DOM element for display.
var map = new google.maps.Map(document.getElementById('map_wp-buildingmap-2'), {
center: new google.maps.LatLng(35.607329, -77.366581),
scrollwheel: false,
zoom: 17,
disableDefaultUI: true,
draggable: false,
disableDoubleClickZoom: true,
styles: [
{ 'featureType': 'water', 'elementType': 'all', 'stylers': [ { 'hue': '#76aee3' }, { 'saturation': 38 }, { 'lightness': -11 }, { 'visibility': 'on' } ] },
{ 'featureType': 'road.highway', 'elementType': 'all', 'stylers': [ { 'hue': '#8dc749' }, { 'saturation': -47 }, { 'lightness': -17 }, { 'visibility': 'on' } ] },
{ 'featureType': 'poi.park', 'elementType': 'all', 'stylers': [ { 'hue': '#c6e3a4' }, { 'saturation': 17 }, { 'lightness': -2 }, { 'visibility': 'on' } ] },
{ 'featureType': 'road.arterial', 'elementType': 'all', 'stylers': [ { 'hue': '#cccccc' }, { 'saturation': -100 }, { 'lightness': 13 }, { 'visibility': 'on' } ] },
{ 'featureType': 'administrative.land_parcel', 'elementType': 'all', 'stylers': [ { 'hue': '#5f5855' }, { 'saturation': 6 }, { 'lightness': -31 }, { 'visibility': 'on' } ] },
{ 'featureType': 'road.local', 'elementType': 'all', 'stylers': [ { 'hue': '#ffffff' }, { 'saturation': -100 }, { 'lightness': 100 }, { 'visibility': 'simplified' } ] },
{ 'featureType': 'water', 'elementType': 'all', 'stylers': [] }
]
});
var data = {"id":3,"type_id":2,"name":"Greenville Centre","icon":{"stroke_color":"#592a8a","fill_color":"#592a8a","image":"570e55c040ac4.png"},"shapes":[{"id":156,"type":"polygon","points":[{"id":2499,"lat":"35.585247373156000000","lng":"-77.364232406253000000","radius":null},{"id":2500,"lat":"35.585025424745000000","lng":"-77.363970220322000000","radius":null},{"id":2501,"lat":"35.585031968687000000","lng":"-77.363959491486000000","radius":null},{"id":2502,"lat":"35.585010155544000000","lng":"-77.363936022157000000","radius":null},{"id":2503,"lat":"35.585030332701000000","lng":"-77.363909200067000000","radius":null},{"id":2504,"lat":"35.585024879416000000","lng":"-77.363903835649000000","radius":null},{"id":2505,"lat":"35.585173208645000000","lng":"-77.363712057704000000","radius":null},{"id":2506,"lat":"35.585175935282000000","lng":"-77.363718092674000000","radius":null},{"id":2507,"lat":"35.585197203053000000","lng":"-77.363687247271000000","radius":null},{"id":2508,"lat":"35.585218470818000000","lng":"-77.363711387152000000","radius":null},{"id":2509,"lat":"35.585215198854000000","lng":"-77.363716751570000000","radius":null},{"id":2510,"lat":"35.585332989455000000","lng":"-77.363857567543000000","radius":null},{"id":2511,"lat":"35.585330808149000000","lng":"-77.363862931961000000","radius":null},{"id":2512,"lat":"35.585399519254000000","lng":"-77.363942057127000000","radius":null},{"id":2513,"lat":"35.585403881862000000","lng":"-77.363934010500000000","radius":null},{"id":2514,"lat":"35.585520036210000000","lng":"-77.364071473712000000","radius":null},{"id":2515,"lat":"35.585517309584000000","lng":"-77.364076167578000000","radius":null},{"id":2516,"lat":"35.585539667914000000","lng":"-77.364102319116000000","radius":null},{"id":2517,"lat":"35.585520036210000000","lng":"-77.364127129549000000","radius":null},{"id":2518,"lat":"35.585525489461000000","lng":"-77.364133835072000000","radius":null},{"id":2519,"lat":"35.585374979581000000","lng":"-77.364324271912000000","radius":null},{"id":2520,"lat":"35.585371162297000000","lng":"-77.364320248598000000","radius":null},{"id":2521,"lat":"35.585351530552000000","lng":"-77.364346400136000000","radius":null},{"id":2522,"lat":"35.585330262822000000","lng":"-77.364320248598000000","radius":null},{"id":2523,"lat":"35.585326445537000000","lng":"-77.364325613016000000","radius":null}]}]};
var bounds = new google.maps.LatLngBounds();
for (j=0;j<=data.shapes.length-1;j++){
//FOR EACH SHAPE
var shape = data.shapes[j];
switch(shape.type) {
// Buildings must always be polygon
case 'polygon':
var points = [];
for (k=0;k<=shape.points.length-1;k++){
points.push({lat: parseFloat(shape.points[k].lat), lng: parseFloat(shape.points[k].lng) });
}
var shape = new google.maps.Polygon({
path: points,
strokeColor: data.icon.stroke_color,
fillColor: data.icon.fill_color,
fillOpacity: 0.35,
strokeWeight:2,
ecudetails: data,
type: 'polygon',
});
for (j=0;j<=shape.getPath().length-1;j++){
bounds.extend(shape.getPath().getArray()[j]);
}
shape.setMap(map);
break;
}
}jQuery('#link_wp-buildingmap-2').attr('href','https://www.google.com/maps?daddr='+ bounds.getCenter().lat() + ',' + bounds.getCenter().lng());
map.setCenter({lat:bounds.getCenter().lat(), lng:bounds.getCenter().lng()});
}
);