Add more data and allow the script to process items with several lights

pull/16/head
Pierre Mesure 2022-01-27 11:04:00 +01:00
rodzic d09e2ff089
commit c0df72a63c
4 zmienionych plików z 279260 dodań i 24 usunięć

Wyświetl plik

@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: |
wget -O data-full.json https://lz4.overpass-api.de/api/interpreter\?data\=%0A%09%09%09%5Bout%3Ajson%5D%5Btimeout%3A200%5D%3B%0A%09%09%09%2F%2F%20gather%20results%0A%09%09%09\(%0A%09%09%09%20%20%2F%2F%20query%20part%20for%3A%20%E2%80%9C%22seamark%3Alight%3Asequence%22%3D\*%E2%80%9D%0A%09%09%09%20%20node%5B%22seamark%3Alight%3Asequence%22%5D\(-90%2C-180%2C90%2C180\)%3B%0A%09%09%09%20%20way%5B%22seamark%3Alight%3Asequence%22%5D\(-90%2C-180%2C90%2C180\)%3B%0A%09%09%09\)%3B%0A%09%09%09%2F%2F%20print%20results%0A%09%09%09out%20body%3B%0A%09%09%09%3E%3B%0A%09%09%09out%20skel%20qt%3B%0A%09%09
wget -O data-full.json https://www.overpass-api.de/api/interpreter?data=%0A%09%09%09%5Bout%3Ajson%5D%5Btimeout%3A300%5D%3B%0A%09%09%09(%0A%09%09%09%20%20node%5B%22seamark%3Alight%3Asequence%22%5D(-90%2C-180%2C90%2C180)%3B%0A%09%09%09%20%20node%5B%22seamark%3Alight%3A1%3Asequence%22%5D(-90%2C-180%2C90%2C180)%3B%0A%09%09%09%20%20way%5B%22seamark%3Alight%3Asequence%22%5D(-90%2C-180%2C90%2C180)%3B%0A%09%09%09%20%20way%5B%22seamark%3Alight%3A1%3Asequence%22%5D(-90%2C-180%2C90%2C180)%3B%0A%09%09%09)%3B%0A%09%09%09out%20body%3B%0A%09%09%09%3E%3B%0A%09%09%09out%20skel%20qt%3B%0A%09%09
- name: Commit the data
uses: nick-invision/retry@v2
with:

Plik diff jest za duży Load Diff

Wyświetl plik

@ -52,13 +52,15 @@
</div>
<a href="https://github.com/geodienst/lighthousemap"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 1000" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
<script id="seamap-query" type="text/x-overpass">
[out:json][timeout:25];
[out:json][timeout:300];
// gather results
(
// query part for: “"seamark:light:sequence"=*”
node["seamark:light:sequence"]({{bbox}});
node["seamark:light:1:sequence"]({{bbox}});
way["seamark:light:sequence"]({{bbox}});
relation["seamark:light:sequence"]({{bbox}});
way["seamark:light:1:sequence"]({{bbox}});
// relation["seamark:light:sequence"]({{bbox}});
);
// print results
out body;
@ -119,7 +121,6 @@
// .replace(/\{\{bbox\}\}/g, bounds.join(','));
let url = 'https://www.overpass-api.de/api/interpreter?data=' + encodeURIComponent(query);
url = 'data-full.json'; // For testing

Wyświetl plik

@ -8,6 +8,30 @@ L.Light = L.Circle.extend({
});
L.Light.sequence = function(tags, fallbackColor = '#FF0') {
renameProperty = function(tags, property) {
console.log('test')
old_key = 'seamark:light:1:' + property
new_key = 'seamark:light:' + property
if (!(new_key in tags) && old_key in tags) {
tags[new_key] = tags[old_key]
}
return tags
}
tags = renameProperty(tags, 'character')
tags = renameProperty(tags, 'colour')
tags = renameProperty(tags, 'group')
tags = renameProperty(tags, 'height')
tags = renameProperty(tags, 'period')
tags = renameProperty(tags, 'range')
tags = renameProperty(tags, 'sector_end')
tags = renameProperty(tags, 'sector_start')
tags = renameProperty(tags, 'sequence')
let character = tags['seamark:light:character'] || 'Fl';
let colors = (tags['seamark:light:colour'] || fallbackColor).split(';');