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
Loading…
Add table
Add a link
Reference in a new issue