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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

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
});

File diff suppressed because one or more lines are too long

View file

@ -30,18 +30,33 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
private static final Log log = LogFactory.getLog(GeoFocusMapLocations.class.getName());
private List<Map<String,String>> geoLocations;
private static String GEO_FOCUS_QUERY = ""
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "SELECT DISTINCT ?label ?location (COUNT(?person) AS ?count) \n"
+ "WHERE {"
+ " ?location rdf:type core:GeographicRegion . \n"
+ " ?location rdfs:label ?label . "
+ " ?location core:geographicFocusOf ?person . \n"
+ " ?person rdf:type foaf:Person \n"
+ "} \n"
+ "GROUP BY ?label ?location \n";
+ "PREFIX geo: <http://aims.fao.org/aos/geopolitical.owl#> \n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n"
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "PREFIX vivoc: <http://vivo.library.cornell.edu/ns/0.1#> \n"
+ "SELECT DISTINCT ?label ?location (COUNT(?person) AS ?count) \n"
+ "WHERE { { \n"
+ " ?location rdf:type core:GeographicRegion . \n"
+ " ?location rdfs:label ?label . \n"
+ " ?location core:geographicFocusOf ?person . \n"
+ " ?person rdf:type foaf:Person . \n"
+ " FILTER (NOT EXISTS {?location a core:StateOrProvince}) \n"
+ "} UNION { \n"
+ " ?location rdf:type core:GeographicRegion . \n"
+ " ?location core:geographicallyContains ?sublocation . \n"
+ " ?location rdfs:label ?label . \n"
+ " ?sublocation core:geographicFocusOf ?person . \n"
+ " ?person rdf:type foaf:Person \n"
+ "} UNION { \n"
+ " ?location rdf:type core:GeographicRegion . \n"
+ " ?location geo:hasMember ?sublocation . \n"
+ " ?location rdfs:label ?label . \n"
+ " ?sublocation core:geographicFocusOf ?person . \n"
+ " ?person rdf:type foaf:Person \n"
+ "} } \n"
+ "GROUP BY ?label ?location \n";
public GeoFocusMapLocations(HttpServlet parent, VitroRequest vreq,
HttpServletResponse resp) {

View file

@ -725,6 +725,8 @@ researcher = researcher
researchers = researchers
currently_no_researchers = There are currently no researchers with a defined geographic focus.
countries_and_regions = countries and regions.
countries = countries
regions = regions
map_states_string = states.
map_state_string = state.
statewide_locations = state-wide locations.

View file

@ -91,6 +91,8 @@
researchersString: '${i18n().researchers}',
currentlyNoResearchers: '${i18n().currently_no_researchers}',
countriesAndRegions: '${i18n().countries_and_regions}',
countriesString: '${i18n().countries}',
regionsString: '${i18n().regions}',
statesString: '${i18n().map_states_string}',
stateString: '${i18n().map_state_string}',
statewideLocations: '${i18n().statewide_locations}',