Socrata Example B
new
by Brent Coder
HTML
<script src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
<title>Google Maps Example</title>
<body>
<div id="map" />
</body>
CSS
#map {
height: 480px;
width: 640px
}
JavaScript
$(window).on('load', function() {
// Construct the catalog query string
url = 'https://www.thedatazone.ca/resource/dukt-62fs.json?$limit=1000';
url2 = 'https://www.thedatazone.ca/resource/33fe-q4e4.json?$limit=1000';
var infoWindow = new google.maps.InfoWindow();
var today = new Date();
var marker = [];
// Intialize our map
var center = new google.maps.LatLng(44.651070, -63.582687);
var mapOptions = {
zoom: 6,
center: center,
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.ZOOM_PAN,
position: google.maps.ControlPosition.TOP_LEFT
},
scaleControl: true,
scaleControlOptions: {
position: google.maps.ControlPosition.BOTTOM_LEFT
}
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
var ctaLayer = new google.maps.KmlLayer({
url:'https://www.eastlink.ca/Portals/0/Wireless/CoverageMaps/Coverage_PEI_VoLTE_170403_v1.kmz',
preserveViewport:true,
map: map
});
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(map);
// Retrieve our data and plot it
$.getJSON(url, function(data, textstatus) {
//console.log(data);
$.each(data, function(i, entry) {
//try {
// console.log('here now');
// entry.location.coordinates["0"]
// console.log('I guess you do exist')
// } catch (e) {
// entry.location.coordinates["0"].push(0);
// entry.location.coordinates["1"].push(0);
// console.log('An error has occurred: '+e.message);
// }
if (typeof(entry.location) !== 'undefined') {
//console.log(entry.aan);
//console.log(entry.location.coordinates);
marker = new google.maps.Marker({
position: new google.maps.LatLng(entry.location.coordinates["1"], entry.location.coordinates["0"]),
...