home page map changes: the map now distinguishes countries from regions and counts are rolled up -- states or provinces into countries, countries into regions. Note: to see the roll up may require data curation to ensure the relations exist among the geographic regions.

This commit is contained in:
tworrall 2013-06-14 10:51:26 -04:00
parent f0a83018f0
commit 8c4103006b
7 changed files with 71 additions and 14 deletions

View file

@ -58,6 +58,16 @@ $(document).ready(function(){
return(mt);
}
function getGeoClass(country) {
var gc = "";
latLongJson.map(function (json) {
if ( json.name == country) {
gc = json.data["geoClass"];
}
});
return(gc);
}
function onEachFeature(feature, layer) {
var popupContent = "";
var uri = "";
@ -113,6 +123,22 @@ $(document).ready(function(){
return radiusContent;
}
function getMarkerFillColor(feature) {
var geoClass = "";
var fillColor;
if (feature.properties && feature.properties.radius) {
geoClass = feature.properties.geoClass;
}
if ( geoClass == "region") {
fillColor = "#abf7f8";
}
else {
fillColor = "#fdf9cd"
}
return fillColor;
}
function checkGlobalCoordinates(feature, layer) {
var theLatLng = new L.LatLng(feature.geometry.coordinates[0],feature.geometry.coordinates[1]);
var mt = feature.properties.mapType;
@ -164,7 +190,7 @@ $(document).ready(function(){
pointToLayer: function(feature, latlng) {
return L.circleMarker(latlng, {
radius: getMarkerRadius(feature),
fillColor: "#fdf9cd", //fdf38a",
fillColor: getMarkerFillColor(feature),
color: "none",
weight: 1,
opacity: 0.8,
@ -189,6 +215,7 @@ $(document).ready(function(){
}
getResearcherCount("global");
appendLegendToLeafletContainer();
} // Canvas/World_Light_Gray_Base
function buildUSMap() {
@ -327,6 +354,7 @@ $(document).ready(function(){
var locale = this.properties.popupContent;
this.geometry.coordinates = getLatLong(locale);
this.properties.mapType = getMapType(locale);
this.properties.geoClass = getGeoClass(locale);
researchAreas["features"].push(this);
});
buildGlobalMap();
@ -367,5 +395,15 @@ $(document).ready(function(){
+ "</font> " + i18nStrings.researchersInString + " <font style='font-size:1.05em;color:#167093'>"
+ areaCount + "</font>" + text);
}
function appendLegendToLeafletContainer() {
var htmlString = "<div class='leaflet-bottom leaflet-left' style='padding:0 0 8px 12px'><ul><li>"
+ "<img alt='" + i18nStrings.regionsString + "' src='" + urlsBase
+ "/images/map_legend_countries.png' style='margin-right:5px'><font style='color:#555'>"
+ i18nStrings.countriesString + "</font></li><li><img alt='" + i18nStrings.regionsString
+ "' src='" + urlsBase
+ "/images/map_legend_regions.png' style='margin-right:5px'><font style='color:#555'>"
+ i18nStrings.regionsString + "</font></li></ul></div>";
$('div.leaflet-control-container').append(htmlString);
}//659667
});