{/layout:set}
This is a resource for Santa Barbara County voters ahead of the Nov. 3, 2020 election, and includes all the locations of County Elections Offices, ballot drop boxes, and polling places.
Each color-coded pin includes information about the voting service available at that location, including hours and address.
The three County Elections Offices are open every weekday through Nov. 3, with staff members available for voter registration, requesting a replacement ballot, and other services.
The ballot drop boxes are available 24 hours a day, and elections staff will collect ballots from them every day. The County Elections Office website has a full list of ballot drop boxes, which are available until 8 p.m. on Nov. 3, and photos of each location.”
A limited number of polling places will be open for four days leading up to election day (Oct. 31 through Nov. 3).
// 'Windows' array collects opened info windows so that we know when windows need to be closed. var Windows = [];
// Set info window for each marker. function bindInfoWindow(marker, map, infowindow) { marker.addListener('click', function() { closeOtherWindows(); infowindow.content; // 'content' is an element of infowindow infowindow.open(map, this); Windows[0] = infowindow; }); }
// Function to close opened windows. function closeOtherWindows() { if (Windows.length > 0) { // call the .close() method Windows[0].close(); // reset the array count to 0 Windows.length = 0; } } var markers = []; var locations; // start the map var map;
function buildMarkers(data){
for (x in data){ //console.log (data[x]);
// .coordinates corresponds to the 'coordinates' element of the array var lat = data[x]["gsx$latitude"]["$t"]; var lng = data[x]["gsx$longitude"]["$t"]; // generate latitude and longtitude position of the marker var latLng = new google.maps.LatLng(lat,lng);
var type = data[x]["gsx$locationtype"]["$t"];
var name = data[x]["gsx$name"]["$t"];
var address = data[x]["gsx$streetaddress"]["$t"];
var hours = data[x]["gsx$hoursstandardized"]["$t"];
hours = hours.replace(/\n/g, "
");
var accessible = data[x]["gsx$accessible"]["$t"];
var details = data[x]["gsx$details"]["$t"];
// define icon image based on type var icon_url = ''; switch(type){ case "Elections Office": icon_url = "https://www.noozhawk.com/wp-content/uploads/2020/11/pin_ceo.png"; hours = '
'+ hours +'
'; break; case "Ballot Drop Box": icon_url = "https://www.noozhawk.com/wp-content/uploads/2020/11/pin_bdb.png"; hours = '
'+ hours +'
'; break; case "Polling Place": icon_url = "https://www.noozhawk.com/wp-content/uploads/2020/11/pin_pp.png"; hours = '
'+ hours +'
'; break; case "Elections Office and Ballot Drop Box": icon_url = "https://www.noozhawk.com/wp-content/uploads/2020/11/pin_ceobdb.png"; hours = '
Election Office Hours
'+ hours +'
'+ '
Ballot Drop Box Hours
24 hours a day, 10/5-11/3
'; break; } // define icon var icon = { url: icon_url, scaledSize: new google.maps.Size(25, 33), // scaled size origin: new google.maps.Point(0,0), // origin anchor: new google.maps.Point(12, 33) // anchor };
// define the marker // change icon based on category var marker = new google.maps.Marker({ position: latLng, map: map, icon: icon, title: data.title });
// info window content var content = '
' + type + '
'+ '
'+ name +'
'+ '
'+ '
'+ hours; if (accessible == "yes"){ content = content + '
Accessible
'; } content = content + '
'+ details +'
'; var infowindow = new google.maps.InfoWindow({ content: content }); /**/ // bind the info window to the marker bindInfoWindow(marker, map, infowindow); } // markers loop
}
function loadAjax(){ if (window.jQuery){ $.ajax({ url: "/election/2020_ballot_box_geo", async: true, success: function (data) { locations = data.feed.entry; //console.log("success " + locations); }, dataType: "json", complete: function () { // call a function on complete buildMarkers(locations); //console.log(locations); } }); } else{ console.log("jquery not loaded, wait for it... "); setTimeout(function() {loadAjax()},50); } }
function initMap() { console.log("initializing map");
loadAjax();
// The map, centered on santa monica map = new google.maps.Map( document.getElementById('map'), { zoom: 9, center: {lat: 34.665, lng: -120.115} } );
} // initMap



