From 7013b7a0102b79b43f5f736f694f4e6cc3157791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=BDdila?= Date: Fri, 8 Dec 2023 08:38:54 +0100 Subject: [PATCH] prettier --- country-names.geojson | 1017 +++++++++++++++------------------------ legend.ts | 48 +- preview.html | 2 +- preview/leaflet-hash.js | 317 ++++++------ style/FeatureLines.tsx | 2 +- style/Highways.tsx | 2 +- style/WaterLine.tsx | 2 +- style/features.tsx | 50 +- style/index.tsx | 2 +- style/routes.tsx | 200 +++----- 10 files changed, 650 insertions(+), 992 deletions(-) diff --git a/country-names.geojson b/country-names.geojson index 0ee57ea..cf8cc99 100644 --- a/country-names.geojson +++ b/country-names.geojson @@ -1,628 +1,393 @@ - { - "type": "FeatureCollection", - "generator": "JOSM", - "features": [ - { - "type": "Feature", - "properties": { - "name:en": "Serbia", - "name": "Србија", - "official_name": "Република Србија" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 19.52269409180, - 45.85941977902 - ], - [ - 22.19237182617, - 42.73088234928 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name:en": "Italy", - "name": "Italia", - "official_name": "Repubblica Italiana" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 9.88767333984, - 45.85942743013 - ], - [ - 10.81052490234, - 44.38670720458 - ], - [ - 13.16159912109, - 42.32607868949 - ], - [ - 16.43552490234, - 40.32981249416 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name:en": "Austria", - "name": "Österreich", - "official_name": "Republik Österreich" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 10.21727416992, - 47.10753026291 - ], - [ - 12.16185424805, - 47.28668934112 - ], - [ - 13.15062377930, - 47.21211323848 - ], - [ - 14.27122924805, - 47.23449709501 - ], - [ - 15.20506713867, - 47.50236637389 - ], - [ - 16.67723510742, - 48.21736022955 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Україна", - "name:en": "Ukraine", - "int_name": "Ukraine" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 23.29100463867, - 49.65341170109 - ], - [ - 25.47728393555, - 48.23199866138 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "France", - "official_name": "République française", - "name:en": "France", - "int_name": "France" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 5.93260620117, - 43.45292686897 - ], - [ - 6.30614135742, - 45.95879527778 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "int_name": "San Marino", - "name": "San Marino", - "name:en": "San Marino" - }, - "geometry": { - "type": "Point", - "coordinates": [ - 12.45830600000, - 43.94586230000 - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "H r v a t s k a", - "official_name": "Republika Hrvatska", - "name:en": "C r o a t i a", - "int_name": "Croatia" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 16.34763427734, - 43.53263635660 - ], - [ - 15.55661865234, - 44.15069692539 - ], - [ - 15.20505615234, - 44.57483305655 - ], - [ - 15.11716552734, - 45.02696598289 - ], - [ - 15.49070068359, - 45.52175929188 - ], - [ - 16.10593505859, - 45.82881456257 - ], - [ - 16.61130615234, - 45.78286367526 - ], - [ - 17.95163818359, - 45.46014604966 - ], - [ - 18.58884521484, - 45.39846540489 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Magyarország", - "name:en": "Hungary", - "int_name": "Hungary" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 16.79807373047, - 46.69468237851 - ], - [ - 19.46775146484, - 47.20465731659 - ], - [ - 22.03855224609, - 48.01933888187 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Shqipëria", - "official_name": "Republika e Shqipërisë", - "name:en": "Albania" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 20.08849548340, - 39.86337555470 - ], - [ - 19.95665954590, - 42.40318259808 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Polska", - "official_name": "Rzeczpospolita Polska", - "name:en": "Poland" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 16.75413940430, - 50.91689441554 - ], - [ - 20.41257568359, - 50.44352704549 - ], - [ - 22.39012573242, - 49.87340478364 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "int_name": "Vatican City", - "name": "Civitas Vaticana - Città del Vaticano", - "name:en": "Vatican City", - "official_name": "Status Civitatis Vaticanae - Stato della Città del Vaticano" - }, - "geometry": { - "type": "Point", - "coordinates": [ - 12.45285270000, - 41.90341100000 - ] - } - }, - { - "type": "Feature", - "properties": { - "int_name": "Liechtenstein", - "name": "Liechtenstein", - "name:en": "Liechtenstein", - "official_name": "Fürstentum Liechtenstein" - }, - "geometry": { - "type": "Point", - "coordinates": [ - 9.55315270000, - 47.14163070000 - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Северна Македонија", - "official_name": "Република Северна Македонија", - "name:en": "North Macedonia", - "int_name": "North Macedonia" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 20.84105346680, - 41.11247706650 - ], - [ - 21.09373901367, - 41.45920361296 - ], - [ - 21.57713745117, - 41.73853666725 - ], - [ - 22.04954956055, - 41.83683604606 - ], - [ - 22.74168823242, - 41.78770519701 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Crna Gora", - "name:en": "Montenegro" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 18.64378784180, - 42.54499476727 - ], - [ - 18.96239135742, - 42.82764669364 - ], - [ - 19.24803588867, - 42.94838943929 - ], - [ - 19.55015991211, - 42.95643055166 - ], - [ - 20.06102416992, - 42.87597215348 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name:en": "Romania", - "int_name": "Romania", - "name": "România" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 22.06052490234, - 45.01143417619 - ], - [ - 23.02732177734, - 45.95116496365 - ], - [ - 24.12595458984, - 46.30142133450 - ], - [ - 25.62009521484, - 46.28623910241 - ], - [ - 26.78464599609, - 45.87472754692 - ], - [ - 28.35569091797, - 44.37885546363 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name:en": "Slovakia", - "int_name": "Slovak Republic", - "name": "Slovensko" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 17.25951049805, - 48.26126296602 - ], - [ - 18.96239135742, - 48.73446261780 - ], - [ - 20.54442260742, - 48.91528707338 - ], - [ - 21.42332885742, - 48.93694217090 - ], - [ - 22.10448120117, - 48.82133978315 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Suisse", - "name:en": "Switzerland" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 6.80052612305, - 46.71727621729 - ], - [ - 10.18431518555, - 46.69467484314 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "official_name": "Репу̀блика Бълга̀рия", - "name:en": "Bulgaria", - "int_name": "Bulgaria", - "name": "Бългaрия" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 23.26903198242, - 41.75493036347 - ], - [ - 27.94920776367, - 43.58039881419 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Bosna i Hercegovina", - "official_name": "Bosna i Hercegovina", - "name:en": "Bosnia and Herzegovina", - "int_name": "Bosnia and Herzegovina" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 16.33665893555, - 44.77014461181 - ], - [ - 17.22654052734, - 44.62176973548 - ], - [ - 17.64402099609, - 44.38670720458 - ], - [ - 18.01755615234, - 44.02443731896 - ], - [ - 18.21531005859, - 43.72349077540 - ], - [ - 18.21531005859, - 43.10099891953 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Kosovo", - "name:en": "Kosovo" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 20.23131774902, - 42.62992133540 - ], - [ - 21.51122497559, - 42.53284832957 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Monaco", - "name:en": "Monaco" - }, - "geometry": { - "type": "Point", - "coordinates": [ - 7.42768320000, - 43.73234920000 - ] - } - }, - { - "type": "Feature", - "properties": { - "name:en": "Slovenia", - "name": "Slovenija", - "official_name": "Republika Slovenija" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 13.87572143555, - 45.89001580556 - ], - [ - 14.93040893555, - 46.14179034976 - ], - [ - 16.13890502930, - 46.61926858206 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": "Deutschland", - "official_name": "Bundesrepublik Deutschland", - "name:en": "Germany", - "int_name": "Germany" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 12.37058349609, - 48.10744586041 - ], - [ - 12.65622802734, - 48.80687793226 - ], - [ - 12.17282958984, - 49.46813834672 - ] - ] - } - }, - { - "type": "Feature", - "properties": { - "name": " Česko ", - "official_name": "Česká republika", - "name:en": "Czechia", - "int_name": "Czechia" - }, - "geometry": { - "type": "LineString", - "coordinates": [ - [ - 12.67820068359, - 50.13467840632 - ], - [ - 17.79782958984, - 49.41098749574 - ] - ] - } - } - ] + "type": "FeatureCollection", + "generator": "JOSM", + "features": [ + { + "type": "Feature", + "properties": { + "name:en": "Serbia", + "name": "Србија", + "official_name": "Република Србија" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [19.5226940918, 45.85941977902], + [22.19237182617, 42.73088234928] + ] + } + }, + { + "type": "Feature", + "properties": { + "name:en": "Italy", + "name": "Italia", + "official_name": "Repubblica Italiana" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [9.88767333984, 45.85942743013], + [10.81052490234, 44.38670720458], + [13.16159912109, 42.32607868949], + [16.43552490234, 40.32981249416] + ] + } + }, + { + "type": "Feature", + "properties": { + "name:en": "Austria", + "name": "Österreich", + "official_name": "Republik Österreich" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [10.21727416992, 47.10753026291], + [12.16185424805, 47.28668934112], + [13.1506237793, 47.21211323848], + [14.27122924805, 47.23449709501], + [15.20506713867, 47.50236637389], + [16.67723510742, 48.21736022955] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Україна", + "name:en": "Ukraine", + "int_name": "Ukraine" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [23.29100463867, 49.65341170109], + [25.47728393555, 48.23199866138] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "France", + "official_name": "République française", + "name:en": "France", + "int_name": "France" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [5.93260620117, 43.45292686897], + [6.30614135742, 45.95879527778] + ] + } + }, + { + "type": "Feature", + "properties": { + "int_name": "San Marino", + "name": "San Marino", + "name:en": "San Marino" + }, + "geometry": { + "type": "Point", + "coordinates": [12.458306, 43.9458623] + } + }, + { + "type": "Feature", + "properties": { + "name": "H r v a t s k a", + "official_name": "Republika Hrvatska", + "name:en": "C r o a t i a", + "int_name": "Croatia" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [16.34763427734, 43.5326363566], + [15.55661865234, 44.15069692539], + [15.20505615234, 44.57483305655], + [15.11716552734, 45.02696598289], + [15.49070068359, 45.52175929188], + [16.10593505859, 45.82881456257], + [16.61130615234, 45.78286367526], + [17.95163818359, 45.46014604966], + [18.58884521484, 45.39846540489] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Magyarország", + "name:en": "Hungary", + "int_name": "Hungary" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [16.79807373047, 46.69468237851], + [19.46775146484, 47.20465731659], + [22.03855224609, 48.01933888187] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Shqipëria", + "official_name": "Republika e Shqipërisë", + "name:en": "Albania" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [20.0884954834, 39.8633755547], + [19.9566595459, 42.40318259808] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Polska", + "official_name": "Rzeczpospolita Polska", + "name:en": "Poland" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [16.7541394043, 50.91689441554], + [20.41257568359, 50.44352704549], + [22.39012573242, 49.87340478364] + ] + } + }, + { + "type": "Feature", + "properties": { + "int_name": "Vatican City", + "name": "Civitas Vaticana - Città del Vaticano", + "name:en": "Vatican City", + "official_name": "Status Civitatis Vaticanae - Stato della Città del Vaticano" + }, + "geometry": { + "type": "Point", + "coordinates": [12.4528527, 41.903411] + } + }, + { + "type": "Feature", + "properties": { + "int_name": "Liechtenstein", + "name": "Liechtenstein", + "name:en": "Liechtenstein", + "official_name": "Fürstentum Liechtenstein" + }, + "geometry": { + "type": "Point", + "coordinates": [9.5531527, 47.1416307] + } + }, + { + "type": "Feature", + "properties": { + "name": "Северна Македонија", + "official_name": "Република Северна Македонија", + "name:en": "North Macedonia", + "int_name": "North Macedonia" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [20.8410534668, 41.1124770665], + [21.09373901367, 41.45920361296], + [21.57713745117, 41.73853666725], + [22.04954956055, 41.83683604606], + [22.74168823242, 41.78770519701] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Crna Gora", + "name:en": "Montenegro" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [18.6437878418, 42.54499476727], + [18.96239135742, 42.82764669364], + [19.24803588867, 42.94838943929], + [19.55015991211, 42.95643055166], + [20.06102416992, 42.87597215348] + ] + } + }, + { + "type": "Feature", + "properties": { + "name:en": "Romania", + "int_name": "Romania", + "name": "România" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [22.06052490234, 45.01143417619], + [23.02732177734, 45.95116496365], + [24.12595458984, 46.3014213345], + [25.62009521484, 46.28623910241], + [26.78464599609, 45.87472754692], + [28.35569091797, 44.37885546363] + ] + } + }, + { + "type": "Feature", + "properties": { + "name:en": "Slovakia", + "int_name": "Slovak Republic", + "name": "Slovensko" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [17.25951049805, 48.26126296602], + [18.96239135742, 48.7344626178], + [20.54442260742, 48.91528707338], + [21.42332885742, 48.9369421709], + [22.10448120117, 48.82133978315] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Suisse", + "name:en": "Switzerland" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [6.80052612305, 46.71727621729], + [10.18431518555, 46.69467484314] + ] + } + }, + { + "type": "Feature", + "properties": { + "official_name": "Репу̀блика Бълга̀рия", + "name:en": "Bulgaria", + "int_name": "Bulgaria", + "name": "Бългaрия" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [23.26903198242, 41.75493036347], + [27.94920776367, 43.58039881419] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Bosna i Hercegovina", + "official_name": "Bosna i Hercegovina", + "name:en": "Bosnia and Herzegovina", + "int_name": "Bosnia and Herzegovina" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [16.33665893555, 44.77014461181], + [17.22654052734, 44.62176973548], + [17.64402099609, 44.38670720458], + [18.01755615234, 44.02443731896], + [18.21531005859, 43.7234907754], + [18.21531005859, 43.10099891953] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Kosovo", + "name:en": "Kosovo" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [20.23131774902, 42.6299213354], + [21.51122497559, 42.53284832957] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Monaco", + "name:en": "Monaco" + }, + "geometry": { + "type": "Point", + "coordinates": [7.4276832, 43.7323492] + } + }, + { + "type": "Feature", + "properties": { + "name:en": "Slovenia", + "name": "Slovenija", + "official_name": "Republika Slovenija" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [13.87572143555, 45.89001580556], + [14.93040893555, 46.14179034976], + [16.1389050293, 46.61926858206] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": "Deutschland", + "official_name": "Bundesrepublik Deutschland", + "name:en": "Germany", + "int_name": "Germany" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [12.37058349609, 48.10744586041], + [12.65622802734, 48.80687793226], + [12.17282958984, 49.46813834672] + ] + } + }, + { + "type": "Feature", + "properties": { + "name": " Česko ", + "official_name": "Česká republika", + "name:en": "Czechia", + "int_name": "Czechia" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [12.67820068359, 50.13467840632], + [17.79782958984, 49.41098749574] + ] + } + } + ] } diff --git a/legend.ts b/legend.ts index 34a5133..282c42a 100644 --- a/legend.ts +++ b/legend.ts @@ -170,7 +170,7 @@ function poi( sk: string, it: string, eithEle?: boolean, - additional: Record = {} + additional: Record = {}, ) { return { categoryId, @@ -190,7 +190,7 @@ function poi( elehack: eithEle ? "\n\u200B" : "", ...additional, }, - eithEle ? -0.00005 : -0.00003 + eithEle ? -0.00005 : -0.00003, ), ], ...props, @@ -229,7 +229,7 @@ const track3rev = asLine( type: "track", tracktype: "grade3", }, - true + true, ); export const legend = { @@ -422,7 +422,7 @@ export const legend = { type: "cutline", }, false, - 16 + 16, ), ], ...propsForZoom(16), @@ -441,7 +441,7 @@ export const legend = { type: "tree_row", }, false, - 16 + 16, ), ], ...propsForZoom(16), @@ -464,7 +464,7 @@ export const legend = { off1: 1, refs1: "2817", }, - true + true, ), ], ...props, @@ -487,7 +487,7 @@ export const legend = { off1: 1, refs1: "1A", }, - true + true, ), ], ...props, @@ -548,7 +548,7 @@ export const legend = { off1: 1, refs1: "Neigh", }, - true + true, ), ], ...props, @@ -562,7 +562,7 @@ export const legend = { "residential", "street, unclassified road or road of unknown kind", "ulica, neklasifikovaná cesta alebo cesta neznámeho druhu", - "residenziale" + "residenziale", ), ...["", 1, 2, 3, 4, 5].map((grade) => ({ categoryId: "communications", @@ -727,7 +727,7 @@ export const legend = { "viditeľnosť trasy je výborná alebo neurčená", "visibilitò eccellente o non specificata", false, - 0 + 0, ), road("path", "good trail visibility", "viditeľnosť trasy je dobrá", "buona visibilità della traccia", false, 1), road( @@ -736,7 +736,7 @@ export const legend = { "trasa je väčšinou viditeľná", "traccia prevalentemente visibile", false, - 2 + 2, ), road( "path", @@ -744,7 +744,7 @@ export const legend = { "trasa je striedavo viditeľná", "traccia talvolta non visibile", false, - 3 + 3, ), road( "path", @@ -752,7 +752,7 @@ export const legend = { "trasa nie je väčšinou viditeľná", "traccia prevalentemente non visibile", false, - 4 + 4, ), road("path", "trail is not visible at all", "trasa nie je vôbec viditeľná", "traccia non visibile", false, 5), { @@ -887,7 +887,7 @@ export const legend = { "public_transport", "public transport shelter", "prístrešok hromadnej dopravy", - "riparo trasporti pubblici" + "riparo trasporti pubblici", ), poi("poi", "guidepost", "guidepost", "smerovník", "guida", true), @@ -915,7 +915,7 @@ export const legend = { name: "Abc", type: "tree", }, - 0 + 0, ), ], ...props, @@ -926,7 +926,7 @@ export const legend = { "tree", "monumental tree", "monumentálny strom", - "monumental tree" // TODO translate + "monumental tree", // TODO translate ), poi("poi", "viewpoint", "viewpoint", "výhľad", "punto panoramico"), @@ -946,7 +946,7 @@ export const legend = { "water_works", "water works, covered water reservoir, water treatment plant", "vodný zdroj, krytá vodná nádrž, čistička", - "opera idrica/trattamento acque" + "opera idrica/trattamento acque", ), poi("water", "fountain", "fountain", "fontána", "fontanella"), @@ -969,7 +969,7 @@ export const legend = { "church", "church, chapel, cathedral, temple, basilica", "kostol, cerkev, kaplnka, katedrála, chrám, bazilika", - "chiesa, cappella, cattedrale, tempio, basilica" + "chiesa, cappella, cattedrale, tempio, basilica", ), poi("institution", "manor", "mansion, manor", "kaštieľ, pánske sídlo", "dimora, maniero"), poi("institution", "theatre", "theatre", "divadlo", "teatro"), @@ -1041,7 +1041,7 @@ export const legend = { "disused_mine", "disused mine, adit or mineshaft", "zatvorená baňa, štôlňa alebo šachta", - "miniera in disuso, pozzo minerario" + "miniera in disuso, pozzo minerario", ), poi("poi", "attraction", "attraction", "atrakcia", "attrazione"), @@ -1078,7 +1078,7 @@ export const legend = { "meadow", "meadow, park, village green, grassland", "lúka, park, mestská zeleň, trávnatá plocha", - "prato, parco, area verde, pascolo" + "prato, parco, area verde, pascolo", ), landcover("heath", "heath", "step", "brughiera"), landcover("scrub", "scrub", "kroviny", "boscaglia"), @@ -1107,14 +1107,14 @@ export const legend = { "playground", "pitch, playground, golf course, track", "ihrisko, detské ihrisko, golfové ihrisko, pretekárska dráha", - "campo da gioco, parco giochi, campo da golf, pista" + "campo da gioco, parco giochi, campo da golf, pista", ), landcover("parking", "parking", "parkovisko", "parcheggio"), landcover( "bunker_silo", "(bunker) silo, storage tank", "silo, skladovací kontajner", - "sbancamento" /* TODO + storage tank */ + "sbancamento" /* TODO + storage tank */, ), landcover("landfill", "landfill", "skládka", "discarica"), { @@ -1141,7 +1141,7 @@ export const legend = { { type: "national_park", }, - 13 + 13, ), ], ...propsForZoom(13), @@ -1173,7 +1173,7 @@ export const legend = { { type: "military", }, - 10 + 10, ), ], ...propsForZoom(10), diff --git a/preview.html b/preview.html index b60f0e9..d3ec36a 100644 --- a/preview.html +++ b/preview.html @@ -1,4 +1,4 @@ - + diff --git a/preview/leaflet-hash.js b/preview/leaflet-hash.js index 70a1007..b2ddcc2 100644 --- a/preview/leaflet-hash.js +++ b/preview/leaflet-hash.js @@ -1,162 +1,157 @@ -(function(window) { - var HAS_HASHCHANGE = (function() { - var doc_mode = window.documentMode; - return ('onhashchange' in window) && - (doc_mode === undefined || doc_mode > 7); - })(); - - L.Hash = function(map) { - this.onHashChange = L.Util.bind(this.onHashChange, this); - - if (map) { - this.init(map); - } - }; - - L.Hash.parseHash = function(hash) { - if(hash.indexOf('#') === 0) { - hash = hash.substr(1); - } - var args = hash.split("/"); - if (args.length == 3) { - var zoom = parseInt(args[0], 10), - lat = parseFloat(args[1]), - lon = parseFloat(args[2]); - if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) { - return false; - } else { - return { - center: new L.LatLng(lat, lon), - zoom: zoom - }; - } - } else { - return false; - } - }; - - L.Hash.formatHash = function(map) { - var center = map.getCenter(), - zoom = map.getZoom(), - precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); - - return "#" + [zoom, - center.lat.toFixed(precision), - center.lng.toFixed(precision) - ].join("/"); - }, - - L.Hash.prototype = { - map: null, - lastHash: null, - - parseHash: L.Hash.parseHash, - formatHash: L.Hash.formatHash, - - init: function(map) { - this.map = map; - - // reset the hash - this.lastHash = null; - this.onHashChange(); - - if (!this.isListening) { - this.startListening(); - } - }, - - removeFrom: function(map) { - if (this.changeTimeout) { - clearTimeout(this.changeTimeout); - } - - if (this.isListening) { - this.stopListening(); - } - - this.map = null; - }, - - onMapMove: function() { - // bail if we're moving the map (updating from a hash), - // or if the map is not yet loaded - - if (this.movingMap || !this.map._loaded) { - return false; - } - - var hash = this.formatHash(this.map); - if (this.lastHash != hash) { - location.replace(hash); - this.lastHash = hash; - } - }, - - movingMap: false, - update: function() { - var hash = location.hash; - if (hash === this.lastHash) { - return; - } - var parsed = this.parseHash(hash); - if (parsed) { - this.movingMap = true; - - this.map.setView(parsed.center, parsed.zoom); - - this.movingMap = false; - } else { - this.onMapMove(this.map); - } - }, - - // defer hash change updates every 100ms - changeDefer: 100, - changeTimeout: null, - onHashChange: function() { - // throttle calls to update() so that they only happen every - // `changeDefer` ms - if (!this.changeTimeout) { - var that = this; - this.changeTimeout = setTimeout(function() { - that.update(); - that.changeTimeout = null; - }, this.changeDefer); - } - }, - - isListening: false, - hashChangeInterval: null, - startListening: function() { - this.map.on("moveend", this.onMapMove, this); - - if (HAS_HASHCHANGE) { - L.DomEvent.addListener(window, "hashchange", this.onHashChange); - } else { - clearInterval(this.hashChangeInterval); - this.hashChangeInterval = setInterval(this.onHashChange, 50); - } - this.isListening = true; - }, - - stopListening: function() { - this.map.off("moveend", this.onMapMove, this); - - if (HAS_HASHCHANGE) { - L.DomEvent.removeListener(window, "hashchange", this.onHashChange); - } else { - clearInterval(this.hashChangeInterval); - } - this.isListening = false; - } - }; - L.hash = function(map) { - return new L.Hash(map); - }; - L.Map.prototype.addHash = function() { - this._hash = L.hash(this); - }; - L.Map.prototype.removeHash = function() { - this._hash.removeFrom(); - }; +(function (window) { + var HAS_HASHCHANGE = (function () { + var doc_mode = window.documentMode; + return "onhashchange" in window && (doc_mode === undefined || doc_mode > 7); + })(); + + L.Hash = function (map) { + this.onHashChange = L.Util.bind(this.onHashChange, this); + + if (map) { + this.init(map); + } + }; + + L.Hash.parseHash = function (hash) { + if (hash.indexOf("#") === 0) { + hash = hash.substr(1); + } + var args = hash.split("/"); + if (args.length == 3) { + var zoom = parseInt(args[0], 10), + lat = parseFloat(args[1]), + lon = parseFloat(args[2]); + if (isNaN(zoom) || isNaN(lat) || isNaN(lon)) { + return false; + } else { + return { + center: new L.LatLng(lat, lon), + zoom: zoom, + }; + } + } else { + return false; + } + }; + + (L.Hash.formatHash = function (map) { + var center = map.getCenter(), + zoom = map.getZoom(), + precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)); + + return "#" + [zoom, center.lat.toFixed(precision), center.lng.toFixed(precision)].join("/"); + }), + (L.Hash.prototype = { + map: null, + lastHash: null, + + parseHash: L.Hash.parseHash, + formatHash: L.Hash.formatHash, + + init: function (map) { + this.map = map; + + // reset the hash + this.lastHash = null; + this.onHashChange(); + + if (!this.isListening) { + this.startListening(); + } + }, + + removeFrom: function (map) { + if (this.changeTimeout) { + clearTimeout(this.changeTimeout); + } + + if (this.isListening) { + this.stopListening(); + } + + this.map = null; + }, + + onMapMove: function () { + // bail if we're moving the map (updating from a hash), + // or if the map is not yet loaded + + if (this.movingMap || !this.map._loaded) { + return false; + } + + var hash = this.formatHash(this.map); + if (this.lastHash != hash) { + location.replace(hash); + this.lastHash = hash; + } + }, + + movingMap: false, + update: function () { + var hash = location.hash; + if (hash === this.lastHash) { + return; + } + var parsed = this.parseHash(hash); + if (parsed) { + this.movingMap = true; + + this.map.setView(parsed.center, parsed.zoom); + + this.movingMap = false; + } else { + this.onMapMove(this.map); + } + }, + + // defer hash change updates every 100ms + changeDefer: 100, + changeTimeout: null, + onHashChange: function () { + // throttle calls to update() so that they only happen every + // `changeDefer` ms + if (!this.changeTimeout) { + var that = this; + this.changeTimeout = setTimeout(function () { + that.update(); + that.changeTimeout = null; + }, this.changeDefer); + } + }, + + isListening: false, + hashChangeInterval: null, + startListening: function () { + this.map.on("moveend", this.onMapMove, this); + + if (HAS_HASHCHANGE) { + L.DomEvent.addListener(window, "hashchange", this.onHashChange); + } else { + clearInterval(this.hashChangeInterval); + this.hashChangeInterval = setInterval(this.onHashChange, 50); + } + this.isListening = true; + }, + + stopListening: function () { + this.map.off("moveend", this.onMapMove, this); + + if (HAS_HASHCHANGE) { + L.DomEvent.removeListener(window, "hashchange", this.onHashChange); + } else { + clearInterval(this.hashChangeInterval); + } + this.isListening = false; + }, + }); + L.hash = function (map) { + return new L.Hash(map); + }; + L.Map.prototype.addHash = function () { + this._hash = L.hash(this); + }; + L.Map.prototype.removeHash = function () { + this._hash.removeFrom(); + }; })(window); diff --git a/style/FeatureLines.tsx b/style/FeatureLines.tsx index acce2b3..1c0c3e5 100644 --- a/style/FeatureLines.tsx +++ b/style/FeatureLines.tsx @@ -1,5 +1,5 @@ import { LinePatternSymbolizer, LineSymbolizer, Style } from "jsxnik/mapnikConfig"; -import { hsl } from "./colors"; +import { colors, hsl } from "./colors"; import { RuleEx } from "./RuleEx"; import { SqlLayer } from "./SqlLayer"; import { seq } from "./utils"; diff --git a/style/Highways.tsx b/style/Highways.tsx index ea00426..9aae7f7 100644 --- a/style/Highways.tsx +++ b/style/Highways.tsx @@ -39,7 +39,7 @@ export function Highways() { minZoom={13} filter={`[class] = 'railway' and ([type] = 'rail' and [service] != 'main' and [service] != '' or ${types( "light_rail", - "tram" + "tram", )})`} > diff --git a/style/WaterLine.tsx b/style/WaterLine.tsx index d267c9a..ca4e526 100644 --- a/style/WaterLine.tsx +++ b/style/WaterLine.tsx @@ -56,7 +56,7 @@ export function WaterLine() { cacheFeatures /> - )) + )), )} {seq(10, 17).map((zoom) => ( @@ -572,29 +559,12 @@ export function FeatureNames() { return ( - - {(extra.exp ?? "[name]") + - (shorten ? ".replace('^(.{30})...+', '$1…')" : "")} + + {(extra.exp ?? "[name]") + (shorten ? ".replace('^(.{30})...+', '$1…')" : "")} {withEle && ( <> - - [elehack] - - - [ele] - + [elehack] + [ele] )} diff --git a/style/index.tsx b/style/index.tsx index 851ef34..9f9ee2a 100644 --- a/style/index.tsx +++ b/style/index.tsx @@ -198,7 +198,7 @@ function generateFreemapStyleInt({ {custom && } {legendLayers && } - + , ); } diff --git a/style/routes.tsx b/style/routes.tsx index 35d8b27..3954384 100644 --- a/style/routes.tsx +++ b/style/routes.tsx @@ -1,9 +1,4 @@ -import { - LinePatternSymbolizer, - LineSymbolizer, - Rule, - Style, -} from "jsxnik/mapnikConfig"; +import { LinePatternSymbolizer, LineSymbolizer, Rule, Style } from "jsxnik/mapnikConfig"; import { RuleEx } from "./RuleEx"; import { tmpdir } from "os"; import path from "path"; @@ -79,9 +74,7 @@ function getRoutesQuery( rights.push("ski", "piste"); } - const [leftsIn, rightsIn] = [lefts, rights].map((side) => - side.map((item) => `'${item}'`).join(",") || "'_x_'" - ); + const [leftsIn, rightsIn] = [lefts, rights].map((side) => side.map((item) => `'${item}'`).join(",") || "'_x_'"); return ` SELECT @@ -205,10 +198,8 @@ function getRoutesQuery( ))) AS arr2 FROM osm_route_members${genSuffix} JOIN osm_routes ON (osm_route_members${genSuffix}.osm_id = osm_routes.osm_id AND state <> 'proposed') WHERE ${ - !includeNetworks - ? "" - : `network IN (${includeNetworks.map((n) => `'${n}'`).join(",")}) AND ` - }geometry && !bbox! + !includeNetworks ? "" : `network IN (${includeNetworks.map((n) => `'${n}'`).join(",")}) AND ` + }geometry && !bbox! GROUP BY member ) AS aaa GROUP BY @@ -231,15 +222,9 @@ export async function initIcons() { Object.entries(colorMap).map(([color, colorValue]) => Promise.all([ // TODO u - fs.writeFile( - path.resolve(tmpdir(), `ski-${color}.svg`), - String(skiSvg).replaceAll("#ff00ff", colorValue), - ), - fs.writeFile( - path.resolve(tmpdir(), `horse-${color}.svg`), - String(horseSvg).replaceAll("#ff00ff", colorValue), - ), - ]) + fs.writeFile(path.resolve(tmpdir(), `ski-${color}.svg`), String(skiSvg).replaceAll("#ff00ff", colorValue)), + fs.writeFile(path.resolve(tmpdir(), `horse-${color}.svg`), String(horseSvg).replaceAll("#ff00ff", colorValue)), + ]), ), ); } @@ -256,11 +241,7 @@ function RouteStyles({ glows, types }: Props) { const isHorse = types.includes("horse"); return [0, 1, 2].flatMap((zoomVar) => { - const zoomParams = zoomVar === 0 - ? { maxZoom: 11 } - : zoomVar === 1 - ? { minZoom: 12, maxZoom: 12 } - : { minZoom: 13 }; + const zoomParams = zoomVar === 0 ? { maxZoom: 11 } : zoomVar === 1 ? { minZoom: 12, maxZoom: 12 } : { minZoom: 13 }; const zo = [1, 2, 3][zoomVar]; // offset from highway @@ -288,21 +269,15 @@ function RouteStyles({ glows, types }: Props) { elements.push( 0`} {...zoomParams}> { - glows - ? ( - - ) - : ( - - ) + glows ? ( + + ) : ( + + ) // 0`} {...zoomParams}> { - glows - ? ( - - ) - : ( - - ) + glows ? ( + + ) : ( + + ) // 0`} {...zoomParams}> - {glows - ? ( - - ) - : ( - - )} + {glows ? ( + + ) : ( + + )} , ); @@ -398,24 +361,18 @@ function RouteStyles({ glows, types }: Props) { // local hiking elements.push( 0`} {...zoomParams}> - {glows - ? ( - - ) - : ( - - )} + {glows ? ( + + ) : ( + + )} , ); } @@ -449,19 +406,17 @@ export function Routes(routeProps: RouteProps) { x.push("horse"); } - return x.length > 0 - ? ( - <> - - - - - ) - : undefined; + return x.length > 0 ? ( + <> + + + + + ) : undefined; })()} - +