Last active
August 29, 2015 14:24
-
-
Save ryanjhodge/5e8dbfe410b9d66d4c4a to your computer and use it in GitHub Desktop.
NPMap.js CartoDB Layer with Date Field
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> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"> | |
<title>CartoDB Layer | Examples | NPMap.js</title> | |
<style> | |
body { | |
margin: 0; | |
padding: 0; | |
} | |
#map { | |
bottom: 0; | |
position: absolute; | |
top: 0; | |
width: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="map"></div> | |
<script> | |
var NPMap = { | |
div: 'map', | |
center: { | |
lat: 58.570, | |
lng: -153.632 | |
}, | |
zoom: 9, | |
overlays: [{ | |
name: 'Animal Locations', | |
styles: { | |
'marker-color': '#d39800', | |
}, | |
table: 'animal_locations', | |
type: 'cartodb', | |
user: 'nps-akro-gis', | |
interactivity: "projectid,animalid,fixdate,fixid,cartodb_id", | |
sql: "SELECT cartodb_id, projectid, animalid, fixid, to_char(fixdate,'YYYY-MM-DD-HH12:MI:SS') as fixdate, the_geom_webmercator FROM animal_locations" | |
}] | |
}; | |
(function() { | |
var s = document.createElement('script'); | |
s.src = 'http://www.nps.gov/lib/npmap.js/2.0.0/npmap-bootstrap.js'; | |
document.body.appendChild(s); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment