Skip to content

Instantly share code, notes, and snippets.

@ajturner
Created June 10, 2011 13:05
Show Gist options
  • Save ajturner/1018791 to your computer and use it in GitHub Desktop.
Save ajturner/1018791 to your computer and use it in GitHub Desktop.
Filter Map in GeoIQ
<script src="http://geocommons.com/javascripts/f1.api.js" type="text/javascript"></script>
<style type="text/css" media="screen">
#embed_map {width: 100%; height: 400px;}
</style>
<div id="embed_map"></div>
<h3>Filters</h3>
<ul>
<li><a href="#" onclick="filterCommunity('MONTGOMERY')">Montgomery</a></li>
<li><a href="#" onclick="filterCommunity('BOWNESS')">Bowness</a></li>
<li><a href="#" onclick="clearCommunity()">All Communities</a></li>
<script type="text/javascript" charset="utf-8">
var mymap = new F1.Maker.Map({
map_id: 48852,
dom_id: "embed_map",
});function clearCommunity() {
mymap.clearFilters(0);
return false;
};
function filterCommunity(name) {
clearCommunity();
console.log(name)
mymap.addFilter(0, {expression: "$[community] == '"+name+"'"})
return false;
};</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment