Changed Nominatim (Reverse Geocoding) service to Komoot Photon.
This commit is contained in:
parent
1d286c3f50
commit
31fb40a220
Notes:
subgit
2018-03-07 17:59:11 +01:00
r836 www/branches/life
@ -41,15 +41,12 @@ function addTableRow(row, table) {
|
||||
/* do reverse geolocation lookup */
|
||||
function getGeolocation(id, lat, lng) {
|
||||
if ( !geolocationTable[id] ) {
|
||||
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
||||
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng } )
|
||||
.done(function( json ) {
|
||||
var city = json.address["city"];
|
||||
if ( ~city ) { city = json.address["town"]; };
|
||||
if ( ~city ) { city = json.address["village"]; };
|
||||
var country = json.address["country"];
|
||||
var countryCode = json.address["country_code"].toUpperCase();
|
||||
var city = json.features[0].properties.city;
|
||||
var countryCode = json.features[0].properties.country;
|
||||
geolocationTable[id] = city;
|
||||
( countryCode != "DE" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||
( countryCode != "Germany" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||
if ( city ) {
|
||||
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
|
||||
var sort = [[0,1],[1,1],[2,1]];
|
||||
@ -120,12 +117,10 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
|
||||
var evaluationStatus = $(this).find('origin > evaluationStatus').text();
|
||||
var type = $(this).find('type').last().text();
|
||||
var location
|
||||
// get location, try this in order:
|
||||
// regional map name, given value, cached value, or nominatim lookup
|
||||
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
|
||||
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
|
||||
// create table row: Date, Time, Mag, Location
|
||||
if ( !eventTable[id] && $.inArray(type, config['event']['typeWhitelist'] )+1 && $.inArray(evaluationStatus, config['event']['evaluationBlacklist'])<0 && Number(mag)+0.05 >= config['event']['minMag'] ) {
|
||||
geolocationTable[id] ? null : getGeolocation(id, lat, lng); // do AJAX lookup if not cached, location will be updated later
|
||||
location = ( geolocationTable[id] || getLocation(lat, lng)[0] || $(this).find('description > text').text() );
|
||||
// general event info (1st line)
|
||||
var row = '<tr class="tablesorter-hasChildRow">'
|
||||
+ '<td class="utctime-date">'+otime.split('.')[0]+'Z</td>'
|
||||
|
@ -41,15 +41,12 @@ function addTableRow(row, table) {
|
||||
/* do reverse geolocation lookup */
|
||||
function getGeolocation(id, lat, lng) {
|
||||
if ( !geolocationTable[id] ) {
|
||||
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng, zoom: 10, format: "json" } )
|
||||
$.getJSON( config['ajax']['nominatimURL'], { lat: lat, lon: lng } )
|
||||
.done(function( json ) {
|
||||
var city = json.address["city"];
|
||||
if ( ~city ) { city = json.address["town"]; };
|
||||
if ( ~city ) { city = json.address["village"]; };
|
||||
var country = json.address["country"];
|
||||
var countryCode = json.address["country_code"].toUpperCase();
|
||||
var city = json.features[0].properties.city;
|
||||
var countryCode = json.features[0].properties.country;
|
||||
geolocationTable[id] = city;
|
||||
( countryCode != "DE" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||
( countryCode != "Germany" ) ? geolocationTable[id] = geolocationTable[id] + " ("+countryCode+")" : null;
|
||||
if ( city ) {
|
||||
$("#eventstable a.toggle[eventid="+id+"]").text(geolocationTable[id]);
|
||||
var sort = [[0,1],[1,1],[2,1]];
|
||||
@ -90,7 +87,7 @@ function ajaxLoadEvents(stime, etime, eventid, url, target) {
|
||||
} else {
|
||||
request_data = {
|
||||
starttime: sprintf("%d-%02d-%02d", rtime.getFullYear(), rtime.getMonth()+1, rtime.getDate()),
|
||||
orderby: 'time',
|
||||
orderby: 'time-asc',
|
||||
minlat: sprintf('%.2f', mapBounds.getSouth()-config['map']['latlngDelta']),
|
||||
maxlat: sprintf('%.2f', mapBounds.getNorth()+config['map']['latlngDelta']),
|
||||
minlon: sprintf('%.2f', mapBounds.getWest()-config['map']['latlngDelta']),
|
||||
|
@ -95,9 +95,8 @@ var config = {
|
||||
dlsvURL: 'dlsv',
|
||||
mseedURL: '/fdsnws/dataselect/1/query',
|
||||
stationURL: '/fdsnws/station/1/query',
|
||||
nominatimURL: '//open.mapquestapi.com/nominatim/v1/reverse.php',
|
||||
// nominatimURL: '//nominatim.openstreetmap.org/reverse',
|
||||
timespan: 60,
|
||||
nominatimURL: 'http://photon.komoot.de/reverse',
|
||||
timespan: 180,
|
||||
},
|
||||
event: {
|
||||
evaluationBlacklist: ['automatic', 'preliminary', 'rejected'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user