An example that uses the OpeNER Tour-pedia APIs and Google Maps API to display all the places in Isola d'Elba as a dot density map. Color is used to distinguish among the four categories to which a place can belong.
Last active
August 29, 2015 14:01
-
-
Save nitaku/6329914587d010bcbc9b to your computer and use it in GitHub Desktop.
OpeNER - Places with categories (GMaps)
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
body { | |
margin: 0; | |
padding: 0; | |
} | |
svg { | |
background: white; | |
} |
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="description" content="OpeNER - Places with categories (GMaps)" /> | |
<title>OpeNER - Places with categories (GMaps)</title> | |
<link rel="stylesheet" href="index.css"> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> | |
</head> | |
<body> | |
<div id="mapcanvas" style="height: 500px; width: 960px"></div> | |
<script src="index.js"></script> | |
</body> | |
</html> |
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
// Get data | |
var url = 'http://wafi.iit.cnr.it/openervm/api/getPlacesByArea?S=42.666&N=42.912&W=10&E=10.5'; | |
$.getJSON(url, function(data) { | |
// Visualize | |
var center = new google.maps.LatLng(42.779152, 10.277379); | |
var myOptions = { | |
zoom: 11, | |
center: center | |
}; | |
var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions); | |
for(var i in data) { // noprotect | |
new google.maps.Marker({ | |
position: new google.maps.LatLng(data[i].lat, data[i].lng), | |
map: map, | |
title: data[i].name, | |
icon: "http://wafi.iit.cnr.it/webvis/examples/opener_places/"+data[i].category+".png" | |
}); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment