#map_wp-buildingmap-3 { height:180px;; }
@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-3'), {
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":"Wright Building","icon":{"stroke_color":"#592a8a","fill_color":"#592a8a","image":"570e55c040ac4.png"},"shapes":[{"id":102,"type":"polygon","points":[{"id":965,"lat":"35.606841047118000000","lng":"-77.363851532573000000","radius":null},{"id":966,"lat":"35.606883571142000000","lng":"-77.363826051587000000","radius":null},{"id":967,"lat":"35.606881390423000000","lng":"-77.363820687169000000","radius":null},{"id":968,"lat":"35.606930456578000000","lng":"-77.363790512318000000","radius":null},{"id":969,"lat":"35.606967528763000000","lng":"-77.363881707424000000","radius":null},{"id":970,"lat":"35.606931546936000000","lng":"-77.363901153440000000","radius":null},{"id":971,"lat":"35.606998058786000000","lng":"-77.364059403772000000","radius":null},{"id":972,"lat":"35.606985519671000000","lng":"-77.364067167509000000","radius":null},{"id":973,"lat":"35.607005146111000000","lng":"-77.364120811690000000","radius":null},{"id":974,"lat":"35.607025862903000000","lng":"-77.364108741749000000","radius":null},{"id":975,"lat":"35.607153434612000000","lng":"-77.364405125845000000","radius":null},{"id":976,"lat":"35.607194868115000000","lng":"-77.364380985964000000","radius":null},{"id":977,"lat":"35.607276644702000000","lng":"-77.364571422804000000","radius":null},{"id":978,"lat":"35.607228669114000000","lng":"-77.364594221581000000","radius":null},{"id":979,"lat":"35.607245024432000000","lng":"-77.364633113611000000","radius":null},{"id":980,"lat":"35.607187235629000000","lng":"-77.364670664538000000","radius":null},{"id":981,"lat":"35.607201410245000000","lng":"-77.364710897673000000","radius":null},{"id":982,"lat":"35.607053121833000000","lng":"-77.364804774988000000","radius":null},{"id":983,"lat":"35.607038947190000000","lng":"-77.364772588480000000","radius":null},{"id":984,"lat":"35.606987700387000000","lng":"-77.364798069466000000","radius":null},{"id":985,"lat":"35.606975706449000000","lng":"-77.364761859644000000","radius":null},{"id":986,"lat":"35.606922278887000000","lng":"-77.364784658421000000","radius":null},{"id":987,"lat":"35.606863399492000000","lng":"-77.364643276669000000","radius":null},{"id":988,"lat":"35.606821965818000000","lng":"-77.364659369923000000","radius":null},{"id":989,"lat":"35.606793616449000000","lng":"-77.364581585862000000","radius":null},{"id":990,"lat":"35.606856857335000000","lng":"-77.364544034936000000","radius":null},{"id":991,"lat":"35.606872122368000000","lng":"-77.364581585862000000","radius":null},{"id":992,"lat":"35.606893929554000000","lng":"-77.364562810399000000","radius":null},{"id":993,"lat":"35.606815423657000000","lng":"-77.364375055768000000","radius":null},{"id":994,"lat":"35.606784893565000000","lng":"-77.364388466813000000","radius":null},{"id":995,"lat":"35.606699845390000000","lng":"-77.364181936719000000","radius":null},{"id":996,"lat":"35.606673676702000000","lng":"-77.364192665555000000","radius":null},{"id":997,"lat":"35.606588628409000000","lng":"-77.363999546506000000","radius":null},{"id":998,"lat":"35.606702026113000000","lng":"-77.363938421477000000","radius":null},{"id":999,"lat":"35.606710749007000000","lng":"-77.363965243567000000","radius":null},{"id":1000,"lat":"35.606733646598000000","lng":"-77.363953173626000000","radius":null},{"id":1001,"lat":"35.606724923707000000","lng":"-77.363922328223000000","radius":null},{"id":1002,"lat":"35.606783803204000000","lng":"-77.363888800610000000","radius":null},{"id":1003,"lat":"35.606794706810000000","lng":"-77.363915622700000000","radius":null},{"id":1004,"lat":"35.606851405536000000","lng":"-77.363883436192000000","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;
}
}
map.setCenter({lat:bounds.getCenter().lat(), lng:bounds.getCenter().lng()});
}
);