Changes based on user feedback

This commit is contained in:
Pieter Vander Vennet 2020-07-01 21:21:29 +02:00
parent 118a60c805
commit 1738fc4252
16 changed files with 342 additions and 64 deletions

View file

@ -171,7 +171,7 @@ export class FilteredLayer {
let marker;
if (style.icon === undefined) {
marker = L.circle(latLng, {
radius: 50,
radius: 25,
color: style.color
});

View file

@ -1,17 +1,26 @@
import * as $ from "jquery"
import {UIEventSource} from "../UI/UIEventSource";
import {Basemap} from "./Basemap";
export class Geocoding {
private static readonly host = "https://nominatim.openstreetmap.org/search?";
static Search(query: string, currentLocation: UIEventSource<{ lat: number, lon: number }>,
handleResult: ((places: { display_name: string, lat: number, lon: number, boundingbox : number[] }[]) => void)) {
static Search(query: string,
basemap: Basemap,
handleResult: ((places: { display_name: string, lat: number, lon: number, boundingbox: number[] }[]) => void),
onFail: (() => void)) {
const b = basemap.map.getBounds();
console.log(b);
$.getJSON(
Geocoding.host + "format=json&accept-language=nl&q=" + query,
Geocoding.host + "format=json&limit=1&viewbox=" +
`${b.getEast()},${b.getNorth()},${b.getWest()},${b.getSouth()}`+
"&accept-language=nl&q=" + query,
function (data) {
handleResult(data);
});
handleResult(data);
}).fail(() => {
onFail();
});
}

View file

@ -71,7 +71,8 @@ export class LayerUpdater {
if (this.IsInBounds()) {
return;
}
if (this._map.map.getZoom() < this._minzoom) {
console.log("Zoom level: ",this._map.map.getZoom(), "Least needed zoom:", this._minzoom)
if (this._map.map.getZoom() < this._minzoom || this._map.Location.data.zoom < this._minzoom) {
console.log("Not running query: zoom not sufficient");
return;
}

View file

@ -79,7 +79,7 @@ export class OsmConnection {
let data = self.userDetails.data;
data.loggedIn = true;
console.log("Log incompleted, userinfo is ", userInfo);
console.log("Login completed, userinfo is ", userInfo);
data.name = userInfo.getAttribute('display_name');
data.csCount = userInfo.getElementsByTagName("changesets")[0].getAttribute("count");
@ -143,16 +143,22 @@ export class OsmConnection {
});
}
public SetPreference(k:string, v:string){
public SetPreference(k:string, v:string) {
if (this.preferences.data[k] === v) {
return;
}
console.log("Updating preference", k, " to ", v);
this.preferences.data[k] = v;
this.preferences.ping();
this.auth.xhr({
method: 'PUT',
path: '/api/0.6/user/preferences/'+k,
options: { header: { 'Content-Type': 'text/plain' } },
path: '/api/0.6/user/preferences/' + k,
options: {header: {'Content-Type': 'text/plain'}},
content: v
},function(error, result) {
if(error){
}, function (error, result) {
if (error) {
console.log("Could not set preference", error);
return;
}

View file

@ -44,6 +44,11 @@ export class Overpass {
console.log("Query failed")
onFail(status);
}
if(json.elements === [] && json.remarks.indexOf("runtime error") > 0){
console.log("Timeout or other runtime error");
return;
}
// @ts-ignore
const geojson = OsmToGeoJson.default(json);
continuation(geojson);