forked from 0x2620/oxjs
geo/map bugfixes
This commit is contained in:
parent
b6c74551fa
commit
dfd2787438
14 changed files with 892 additions and 809 deletions
|
|
@ -1,36 +1,33 @@
|
|||
Ox.load('UI', {
|
||||
Ox.load({UI: {
|
||||
debug: true,
|
||||
hideScreen: true,
|
||||
showScreen: true,
|
||||
theme: 'modern'
|
||||
}, function() {
|
||||
|
||||
Ox.load('Geo', function() {
|
||||
}, Geo: {}}, function() {
|
||||
|
||||
Ox.getJSON('json/cities50000.json', function(cities) {
|
||||
|
||||
var places = cities.map(function(city, i) {
|
||||
var countryCode = city.country_code == 'XK' ? 'RS-KO' : city.country_code,
|
||||
marker = city.population > 10000000 ? {size: 24, color: [255, 0, 0]} :
|
||||
city.population > 5000000 ? {size: 22, color: [255, 32, 0]} :
|
||||
city.population > 2000000 ? {size: 20, color: [255, 64, 0]} :
|
||||
city.population > 1000000 ? {size: 18, color: [255, 96, 0]} :
|
||||
city.population > 500000 ? {size: 16, color: [255, 128, 0]} :
|
||||
city.population > 200000 ? {size: 14, color: [255, 160, 0]} :
|
||||
city.population > 100000 ? {size: 12, color: [255, 192, 0]} :
|
||||
city.population > 50000 ? {size: 10, color: [255, 224, 0]} :
|
||||
{size: 8, color: [255, 255, 0]},
|
||||
area = Math.max(city.population, 1) * 100,
|
||||
var area = Math.max(city.population, 1) * 100,
|
||||
geoname = city.name + ', ' + Ox.getCountryByCode(city.country_code).name,
|
||||
latSize = Math.sqrt(area) / Ox.EARTH_CIRCUMFERENCE * 360,
|
||||
lngSize = Math.sqrt(area) * Ox.getDegreesPerMeter(city.latitude);
|
||||
lngSize = Math.sqrt(area) * Ox.getDegreesPerMeter(city.latitude),
|
||||
marker = city.population > 10000000 ? {size: 24, color: [255, 0, 0]}
|
||||
: city.population > 5000000 ? {size: 22, color: [255, 32, 0]}
|
||||
: city.population > 2000000 ? {size: 20, color: [255, 64, 0]}
|
||||
: city.population > 1000000 ? {size: 18, color: [255, 96, 0]}
|
||||
: city.population > 500000 ? {size: 16, color: [255, 128, 0]}
|
||||
: city.population > 200000 ? {size: 14, color: [255, 160, 0]}
|
||||
: city.population > 100000 ? {size: 12, color: [255, 192, 0]}
|
||||
: city.population > 50000 ? {size: 10, color: [255, 224, 0]}
|
||||
: {size: 8, color: [255, 255, 0]};
|
||||
return {
|
||||
alternativeNames: [],
|
||||
area: area,
|
||||
countryCode: countryCode,
|
||||
countryCode: city.country_code,
|
||||
editable: true,
|
||||
flag: countryCode,
|
||||
geoname: city.name + ', ' + Ox.getCountryByCode(countryCode).name,
|
||||
geonameSort: getGeonameSort(city.name + ', ' + Ox.getCountryByCode(countryCode).name),
|
||||
geoname: geoname,
|
||||
geonameSort: getGeonameSort(geoname),
|
||||
id: Ox.encodeBase32(Ox.uid()),
|
||||
markerColor: marker.color,
|
||||
markerSize: marker.size,
|
||||
|
|
@ -206,6 +203,5 @@ Ox.load('Geo', function() {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue