<!DOCTYPE html>
<html lang="en">
<head>
<title>Map of National Parks</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<script src="https://code.jquery.com/jquery-2.0.0.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
font-family: 'oswald';
}
.leaflet-container .leaflet-control-zoom {
margin-left: 13px;
margin-top: 70px;
}
#map {
z-index: 1;
}
#title {
z-index: 2;
position: absolute;
left: 10px;
}
</style>
</head>
<body>
<h1 id="title">U.S. National Parks v6.5.5</h1>
<div id="map"></div>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script>
center = new L.LatLng(39.82, -98.57);
zoom = 5;
var map = L.map('map').setView(center, zoom);
var markerLayerGroup = L.layerGroup().addTo(map);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
}).addTo(map);
function getPins(e) {
bounds = map.getBounds();
url = "ws/parks/within?lat1=" +
bounds.getNorthEast().lat + "&lon1=" + bounds.getNorthEast().lng +
"&lat2=" + bounds.getSouthWest().lat + "&lon2=" + bounds.getSouthWest().lng;
$.get(url, pinTheMap, "json")
}
Number.prototype.toCurrencyString = function () {
return "$" + Math.floor(this).toLocaleString() + (this % 1).toFixed(2).toLocaleString().replace(/^0/, '');
}
function pinTheMap(data) {
//clear the current pins
map.removeLayer(markerLayerGroup);
//add the new pins
var markerArray = new Array(data.length)
for (var i = 0; i < data.length; i++) {
nationalPark = data[i];
var popupInformation = "<b>" + nationalPark.locationName + "</b></br>" +
nationalPark.address + "</br>" +
nationalPark.city + ", " + nationalPark.state + "</br>" +
nationalPark.zipCode + "</br>";
markerArray[i] = L.marker(
[nationalPark.location.coordinates[1], nationalPark.location.coordinates[0]]).bindPopup(popupInformation);
}
markerLayerGroup = L.layerGroup(markerArray).addTo(map);
}
map.on('dragend', getPins);
map.on('zoomend', getPins);
map.whenReady(getPins)
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Map of National Parks</title>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity_no="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>
<script src="https://code.jquery.com/jquery-2.0.0.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
font-family: 'oswald';
}
.leaflet-container .leaflet-control-zoom {
margin-left: 13px;
margin-top: 70px;
}
#map {
z-index: 1;
}
#title {
z-index: 2;
position: absolute;
left: 10px;
}
</style>
</head>
<body>
<h1 id="title">U.S. National Parks v6.5.8</h1>
<div id="map"></div>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity_no="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin=""></script>
<script type="text/coffeescript" src="scripts/sprite.coffee"></script>
<script type="text/coffeescript" src "script.coffee"></script>
<script>
center = new L.LatLng(39.82, -98.57);
zoom = 5;
var map = L.map('map').setView(center, zoom);
var markerLayerGroup = L.layerGroup().addTo(map);
L.tileLayer('https://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=816f897a456b4595a09bf8e1d42cfa0b', {
maxZoom: 18,
attribution: 'Maps © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
function getPins(e) {
bounds = map.getBounds();
url = "ws/parks/within?lat1=" +
bounds.getNorthEast().lat + "&lon1=" + bounds.getNorthEast().lng +
"&lat2=" + bounds.getSouthWest().lat + "&lon2=" + bounds.getSouthWest().lng;
$.get(url, pinTheMap, "json")
}
Number.prototype.toCurrencyString = function () {
return "$" + Math.floor(this).toLocaleString() + (this % 1).toFixed(2).toLocaleString().replace(/^0/, '');
}
function pinTheMap(data) {
//clear the current pins
map.removeLayer(markerLayerGroup);
//add the new pins
var markerArray = new Array(data.length)
for (var i = 0; i < data.length; i++) {
nationalPark = data[i];
var popupInformation = "<b>" + nationalPark.locationName + "</b></br>" +
nationalPark.address + "</br>" +
nationalPark.city + ", " + nationalPark.state + "</br>" +
nationalPark.zipCode + "</br>";
markerArray[i] = L.marker(
[nationalPark.location.coordinates[1], nationalPark.location.coordinates[0]], { icon: L.icon({ iconUrl: 'images/redicon.png', iconAnchor: [12.5,40]}) }).bindPopup(popupInformation);
}
markerLayerGroup = L.layerGroup(markerArray).addTo(map);
}
map.on('dragend', getPins);
map.on('zoomend', getPins);
map.whenReady(getPins)
</script>
</body>
</html>