update geo focus map to use localName first, then label
This commit is contained in:
parent
2474be9072
commit
6927e7b86d
3 changed files with 39 additions and 13 deletions
|
@ -35,14 +35,22 @@ $(document).ready(function(){
|
|||
$('a#globalLink').removeClass("selected");
|
||||
});
|
||||
|
||||
function getLatLong(country) {
|
||||
function getLatLong(localName,popup) {
|
||||
var lat = [];
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == country) {
|
||||
if ( json.local == localName) {
|
||||
lat.push(json.data["longitude"]);
|
||||
lat.push(json.data["latitude"]);
|
||||
}
|
||||
});
|
||||
if (lat.length == 0) {
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == popup) {
|
||||
lat.push(json.data["longitude"]);
|
||||
lat.push(json.data["latitude"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (lat.length == 0) {
|
||||
lat.push(0.0);
|
||||
lat.push(0.0);
|
||||
|
@ -50,23 +58,37 @@ $(document).ready(function(){
|
|||
return(lat);
|
||||
}
|
||||
|
||||
function getMapType(country) {
|
||||
function getMapType(localName,popup) {
|
||||
var mt = "";
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == country) {
|
||||
if ( json.local == localName) {
|
||||
mt = json.data["mapType"];
|
||||
}
|
||||
});
|
||||
if ( mt.length == 0 ) {
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == popup) {
|
||||
mt = json.data["mapType"];
|
||||
}
|
||||
});
|
||||
}
|
||||
return(mt);
|
||||
}
|
||||
|
||||
function getGeoClass(country) {
|
||||
function getGeoClass(localName,popup) {
|
||||
var gc = "";
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == country) {
|
||||
if ( json.local == localName) {
|
||||
gc = json.data["geoClass"];
|
||||
}
|
||||
});
|
||||
if ( gc.length == 0 ) {
|
||||
latLongJson.map(function (json) {
|
||||
if ( json.name == popup) {
|
||||
gc = json.data["geoClass"];
|
||||
}
|
||||
});
|
||||
}
|
||||
return(gc);
|
||||
}
|
||||
|
||||
|
@ -342,7 +364,6 @@ $(document).ready(function(){
|
|||
action: "getGeoFocusLocations",
|
||||
},
|
||||
complete: function(xhr, status) {
|
||||
|
||||
var results = $.parseJSON(xhr.responseText);
|
||||
if ( results.length == 0 ) {
|
||||
var html = i18nStrings.currentlyNoResearchers;
|
||||
|
@ -355,10 +376,11 @@ $(document).ready(function(){
|
|||
}
|
||||
else {
|
||||
$.each(results, function() {
|
||||
var locale = this.properties.popupContent;
|
||||
this.geometry.coordinates = getLatLong(locale);
|
||||
this.properties.mapType = getMapType(locale);
|
||||
this.properties.geoClass = getGeoClass(locale);
|
||||
var popup = this.properties.popupContent;
|
||||
var localName = this.properties.local;
|
||||
this.geometry.coordinates = getLatLong(localName,popup);
|
||||
this.properties.mapType = getMapType(localName,popup);
|
||||
this.properties.geoClass = getGeoClass(localName,popup);
|
||||
researchAreas["features"].push(this);
|
||||
});
|
||||
buildGlobalMap();
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -36,7 +36,8 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
+ "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(DISTINCT ?person) AS ?count) \n"
|
||||
+ "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> "
|
||||
+ "SELECT DISTINCT ?label ?location (afn:localname(?location) AS ?localName) (COUNT(DISTINCT ?person) AS ?count) \n"
|
||||
+ "WHERE { { \n"
|
||||
+ " ?location rdf:type core:GeographicRegion . \n"
|
||||
+ " ?location rdfs:label ?label . \n"
|
||||
|
@ -77,6 +78,7 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
String label = map.get("label");
|
||||
String html = map.get("count");
|
||||
String uri = map.get("location");
|
||||
String local = map.get("localName");
|
||||
if ( uri != null ) {
|
||||
uri = UrlBuilder.urlEncode(uri);
|
||||
}
|
||||
|
@ -107,6 +109,8 @@ public class GeoFocusMapLocations extends AbstractAjaxResponder {
|
|||
+ radius
|
||||
+ ",\"uri\": \""
|
||||
+ uri
|
||||
+ "\",\"local\": \""
|
||||
+ local
|
||||
+ "\"}},";
|
||||
response += tempStr;
|
||||
previousLabel = label;
|
||||
|
|
Loading…
Add table
Reference in a new issue