Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Wello/Wello/www/map.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
155 lines (118 sloc)
5.19 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html class="no-js" lang=""> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<title>WRA | Map</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="apple-touch-icon" href="apple-touch-icon.png"> | |
<!-- Place favicon.ico in the root directory --> | |
<link rel="stylesheet" href="css/normalize.css"> | |
<link rel="stylesheet" href="css/main.css"> | |
<link rel="stylesheet" href="css/well-card.css"> | |
<link rel="stylesheet" href="css/map-desktop.css"> | |
<script src="js/vendor/modernizr-2.8.3.min.js"></script> | |
</head> | |
<body> | |
<!--[if lt IE 8]> | |
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p> | |
<![endif]--> | |
<!-- Add your site or application content here --> | |
<nav class="top-nav"> | |
<div class="main-bttns"> | |
<h1>Well Report App</h1> | |
<a href="search.php"><img src="img/search.svg" alt="menu" /></a> | |
</div> | |
</nav> | |
<main class="map"> | |
<div id="map" class="google-maps"> | |
</div> | |
</main> | |
<nav class="bottom-nav"> | |
<a href="map.php"><img src="img/map.svg" alt="menu" /></a> | |
<a href="wells-list.php"><img src="img/list.svg" alt="menu" /></a> | |
</nav> | |
<nav class="fabs"> | |
<a class="add-well" href="form.php"> <img src="img/add.svg" alt="add well" /></a> | |
</nav> | |
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script> | |
<script> | |
window.jQuery || document.write('<script src="js/vendor/jquery-1.12.0.min.js"><\/script>') | |
</script> | |
<script src="js/plugins.js"></script> | |
<script src="js/main.js"></script> | |
<script> | |
function initMap() { | |
var map = new google.maps.Map(document.getElementById('map'), { | |
center: new google.maps.LatLng(41.31412, -72.23311), | |
zoom: 16 | |
}); | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function (position) { | |
initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); | |
map.setCenter(initialLocation); | |
}); | |
} | |
var infoWindow = new google.maps.InfoWindow; | |
// Change this depending on the name of your PHP or XML file | |
downloadUrl('http://wellreportapp.uconn.edu/xmlGenerate.php', function(data) { | |
var xml = data.responseXML; | |
var markers = xml.documentElement.getElementsByTagName('marker'); | |
Array.prototype.forEach.call(markers, function(markerElem) { | |
var id = markerElem.getAttribute('id'); | |
var name = markerElem.getAttribute('id'); | |
var address = markerElem.getAttribute('address'); | |
var point = new google.maps.LatLng( | |
parseFloat(markerElem.getAttribute('lat')), | |
parseFloat(markerElem.getAttribute('lng'))); | |
var infowincontent = document.createElement('div'); | |
var strong = document.createElement('strong'); | |
strong.textContent = address | |
infowincontent.appendChild(strong); | |
infowincontent.appendChild(document.createElement('br')); | |
var text = document.createElement('text'); | |
text.textContent = name | |
infowincontent.appendChild(text); | |
infowincontent.appendChild(document.createElement('br')); | |
var clicker = document.createElement('a'); | |
var clickerText = document.createTextNode("go to details..."); | |
clicker.setAttribute('href',"http://wellreportapp.uconn.edu/details.php?Well_ID="+id); | |
clicker.appendChild(clickerText); | |
infowincontent.appendChild(clicker); | |
var marker = new google.maps.Marker({ | |
map: map, | |
position: point | |
}); | |
marker.addListener('click', function() { | |
infoWindow.setContent(infowincontent); | |
infoWindow.open(map, marker); | |
}); | |
}); | |
}); | |
} | |
function downloadUrl(url, callback) { | |
var request = window.ActiveXObject ? | |
new ActiveXObject('Microsoft.XMLHTTP') : | |
new XMLHttpRequest; | |
request.onreadystatechange = function() { | |
if (request.readyState == 4) { | |
request.onreadystatechange = doNothing; | |
callback(request, request.status); | |
} | |
}; | |
request.open('GET', url, true); | |
request.send(null); | |
} | |
function doNothing() {} | |
</script> | |
<script async defer | |
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCNSoPsxLd0LbvQaH9R6npO7jj-jKAXyQ4&callback=initMap"> | |
</script> | |
</body> | |
</html> | |
<!-- | |
notes : | |
we will need a file where we import the well name, address, longiture and latitude within the range we chose | |
we need a food loop for it | |
--> |