teia-tw / watermap

Other
6 stars 4 forks source link

水點的讀取改由定位點所在位置方圓一定範圍 #7

Open yellowsoar opened 5 years ago

yellowsoar commented 5 years ago

目前水點的讀取是直接讀取整個台灣地區,
如果改成讀取定位點所在位置的方圓一定範圍,
則將可擴大飲水地圖的適用性。

yellowsoar commented 5 years ago

以方圓一公里為例,原本query 的部分要改: node["amenity"="drinking_water"](around:1000,latitude,longitude);out body;out skel qt; 如果是在移動結束後才 query... 可能會因為歐洲伺服器傳過來要很久而導致使用者一直移來移去, 然後送出多次 query,接著就可能被 ban 了, 同理縮放也是一樣的情況... 所以如果考慮不要大改的作法, 應該是在這兩種動作結束後要暫停移動或縮放功能, 然後等 api response 後才可以在移動.. 我有懂 @pm5 為什麼說可能要大改了。囧

yellowsoar commented 5 years ago

改用新的 leaflet-overpass-layer 可能有點幫助, 有 beforeRequest , afterRequest & onSuccesshttps://github.com/GuillaumeAmat/leaflet-overpass-layer

voidlps commented 5 years ago

一般預防 pan / zoom 大量重複 request 的作法,可能還是要用類似圖磚的邏輯,預先 preload 相鄰地區並 cache