diff --git a/UI/BigComponents/BackgroundMapSwitch.ts b/UI/BigComponents/BackgroundMapSwitch.ts index 268fde159..16fd17bb3 100644 --- a/UI/BigComponents/BackgroundMapSwitch.ts +++ b/UI/BigComponents/BackgroundMapSwitch.ts @@ -197,7 +197,6 @@ export default class BackgroundMapSwitch extends Combine { super(buttons) this.SetClass("flex") - currentBackground.addCallbackAndRun(bg => console.trace("Current background is", bg.id)) } } \ No newline at end of file diff --git a/UI/BigComponents/ImportButton.ts b/UI/BigComponents/ImportButton.ts index f42d0f88b..58a3ff579 100644 --- a/UI/BigComponents/ImportButton.ts +++ b/UI/BigComponents/ImportButton.ts @@ -128,11 +128,13 @@ ${Utils.Special_visualizations_tagsToApplyHelpText} name: "minzoom", doc: "How far the contributor must zoom in before being able to import the point", defaultValue: "18" - }, { + }, + { name: "Snap onto layer(s)/replace geometry with this other way", doc: " - If the value corresponding with this key starts with 'way/' and the feature is a LineString or Polygon, the original OSM-way geometry will be changed to match the new geometry\n" + " - If a way of the given layer(s) is closeby, will snap the new point onto this way (similar as preset might snap). To show multiple layers to snap onto, use a `;`-seperated list", - }, { + }, + { name: "snap max distance", doc: "The maximum distance that this point will move to snap onto a layer (in meters)", defaultValue: "5" @@ -173,7 +175,7 @@ ${Utils.Special_visualizations_tagsToApplyHelpText} } else { - const snapToLayers = args[5]?.split(";").filter(s => s !== "") + const snapToLayers = args[5]?.split(";")?.filter(s => s !== "") const snapToLayersMaxDist = Number(args[6] ?? 6) if (targetLayer === undefined) { diff --git a/UI/SpecialVisualizations.ts b/UI/SpecialVisualizations.ts index 7839803f9..dc1fc2c7a 100644 --- a/UI/SpecialVisualizations.ts +++ b/UI/SpecialVisualizations.ts @@ -31,8 +31,6 @@ import SimpleMetaTagger from "../Logic/SimpleMetaTagger"; import MultiApply from "./Popup/MultiApply"; import AllKnownLayers from "../Customizations/AllKnownLayers"; import ShowDataLayer from "./ShowDataLayer/ShowDataLayer"; -import Link from "./Base/Link"; -import List from "./Base/List"; import {SubtleButton} from "./Base/SubtleButton"; import ChangeTagAction from "../Logic/Osm/Actions/ChangeTagAction"; import {And} from "../Logic/Tags/And"; diff --git a/assets/layers/address/address.json b/assets/layers/address/address.json new file mode 100644 index 000000000..1f93a712b --- /dev/null +++ b/assets/layers/address/address.json @@ -0,0 +1,175 @@ +{ + "id": "address", + "name": { + "en": "Known addresses in OSM", + "de": "Bekannte Adressen in OSM" + }, + "minzoom": 18, + "source": { + "osmTags": { + "or": [ + "addr:housenumber~*", + "addr:street~*", + "ref:inspireid~*" + ] + } + }, + "calculatedTags": [ + "_closest_3_street_names=feat.closestn('named_streets',3, 'name').map(f => f.feat.properties.name)", + "_closest_street:0:name=JSON.parse(feat.properties._closest_3_street_names)[0]", + "_closest_street:1:name=JSON.parse(feat.properties._closest_3_street_names)[1]", + "_closest_street:2:name=JSON.parse(feat.properties._closest_3_street_names)[2]" + ], + "title": { + "render": { + "en": "Known address", + "de": "Bekannte Adresse" + } + }, + "description": { + "en": "Addresses", + "nl": "Adressen", + "de": "Adressen", + "ru": "Адреса" + }, + "tagRenderings": [ + { + "id": "housenumber", + "render": { + "en": "The housenumber is {addr:housenumber}", + "nl": "Het huisnummer is {addr:housenumber}", + "de": "Die Hausnummer ist {addr:housenumber}" + }, + "question": { + "en": "What is the number of this house?", + "de": "Wie lautet die Nummer dieses Hauses?" + }, + "freeform": { + "key": "addr:housenumber", + "addExtraTags": [ + "nohousenumber=" + ] + }, + "mappings": [ + { + "if": { + "and": [ + "nohousenumber=yes" + ] + }, + "then": { + "en": "This building has no house number", + "nl": "Dit gebouw heeft geen huisnummer", + "de": "Dieses Gebäude hat keine Hausnummer" + } + } + ] + }, + + { + "id": "street", + "render": { + "en": "This address is in street {addr:street}", + "de": "Diese Adresse befindet sich in der Straße {addr:street}" + }, + "question": { + "en": "What street is this address located in?", + "de": "In welcher Straße befindet sich diese Adresse?" + }, + "freeform": { + "key": "addr:street" + }, + "mappings": [ + { + "if": "addr:street:={_closest_street:0:name}", + "then": "Located in {_closest_street:0:name}", + "hideInAnswer": "_closest_street:0:name=" + }, + { + "if": "addr:street:={_closest_street:1:name}", + "then": "Located in {_closest_street:1:name}", + "hideInAnswer": "_closest_street:1:name=" + }, + { + "if": "addr:street:={_closest_street:2:name}", + "then": "Located in {_closest_street:2:name}", + "hideInAnswer": "_closest_street:2:name=" + } + ], + "condition": { + "and": [ + "nohousenumber!~yes" + ] + } + }, + { + "id": "fixme", + "render": "Fixme description{fixme}", + "question": { + "en": "What should be fixed here? Please explain" + }, + "freeform": { + "key": "fixme" + }, + "mappings": [ + { + "if": "fixme=", + "then": "No fixme - write something here to explain complicated cases" + } + ] + } + ], + "mapRendering": [ + { + "icon": { + "render": "./assets/themes/uk_addresses/housenumber_ok.svg", + "mappings": [ + { + "if": { + "or": [ + { + "and": [ + "addr:housenumber=", + "nohousenumber!=yes" + ] + }, + "addr:street=" + ] + }, + "then": "./assets/themes/uk_addresses/housenumber_unknown.svg" + } + ] + }, + "iconSize": { + "render": "40,40,center" + }, + "location": [ + "point" + ] + }, + { + "color": { + "render": "#00f", + "mappings": [ + { + "if": { + "or": [ + { + "and": [ + "addr:housenumber=", + "nohousenumber!=yes" + ] + }, + "addr:street=" + ] + }, + "then": "#ff0" + } + ] + }, + "width": { + "render": "8" + } + } + ] +} \ No newline at end of file diff --git a/assets/layers/crab_address/crab_address.json b/assets/layers/crab_address/crab_address.json new file mode 100644 index 000000000..bba569cc6 --- /dev/null +++ b/assets/layers/crab_address/crab_address.json @@ -0,0 +1,33 @@ +{ + "id": "crab_address", + "description": "Address data for Flanders by the governement, suited for import into OpenStreetMap. Datadump from 2021-10-26. This layer contains only visualisation logic. Import buttons should be added via an override.", + "source": { + "osmTags": "HUISNR~*", + "geoJson": "https://pietervdvn.github.io/CRAB_2021_10_26/tile_{z}_{x}_{y}.geojson", + "geoJsonZoomLevel": 18, + "maxCacheAge": 0 + }, + "name": "CRAB-addressen", + "title": "CRAB-adres", + "mapRendering": [ + { + "location": [ + "point", + "centroid" + ], + "iconSize": "15,15,center", + "label": { + "render": "
{HNRLABEL}
" + } + } + ], + "tagRenderings": [ + { + "id": "render_crab", + "render": { + "nl":"Volgens het CRAB ligt hier {STRAATNM} {HUISNR} (label: {HNRLABEL})" + } + }, + "all_tags" + ] +} \ No newline at end of file diff --git a/assets/themes/grb_import/grb.json b/assets/themes/grb_import/grb.json index cccd57716..d5e8636cb 100644 --- a/assets/themes/grb_import/grb.json +++ b/assets/themes/grb_import/grb.json @@ -1,13 +1,13 @@ { "id": "grb", "title": { - "nl": "GRB Fixup" + "nl": "GRB import helper" }, "shortDescription": { - "nl": "Grb Fixup" + "nl": "Grb import helper tool" }, "description": { - "nl": "GRB Fixup", + "nl": "Dit thema helpt het GRB importeren.", "en": "This theme is an attempt to help automating the GRB import.
Note that this is very hacky and 'steals' the GRB data from an external site; in order to do this, you need to install and activate this firefox extension for it to work." }, "language": [ @@ -355,74 +355,50 @@ ] }, { - "id": "crab-addresses 2021-10-26", - "source": { - "osmTags": "HUISNR~*", - "geoJson": "https://raw.githubusercontent.com/pietervdvn/pietervdvn.github.io/master/CRAB_2021_10_26/tile_{z}_{x}_{y}.geojson", - "#geoJson": "https://pietervdvn.github.io/CRAB_2021_10_26/tile_{z}_{x}_{y}.geojson", - "geoJsonZoomLevel": 18, - "maxCacheAge": 0 - }, - "name": "CRAB-addressen", - "title": "CRAB-adres", - "mapRendering": [ - { - "location": [ - "point", - "centroid" - ], - "iconSize": "15,15,center", - "label": { - "render": "
{HNRLABEL}
" - } - } - ], - "calculatedTags": [ - "_embedded_in=feat.overlapWith('OSM-buildings')[0]?.feat?.properties ", - "_embedding_nr=feat.get('_embedded_in')['addr:housenumber']", - "_embedding_street=feat.get('_embedded_in')['addr:street']", - "_embedding_id=feat.get('_embedded_in').id" - ], - "isShown": { - "render": "yes", - "mappings": [ + "builtin": "crab_address", + "override": { + "calculatedTags+": [ + "_embedded_in=feat.overlapWith('OSM-buildings')[0]?.feat?.properties ", + "_embedding_nr=feat.get('_embedded_in')['addr:housenumber']", + "_embedding_street=feat.get('_embedded_in')['addr:street']", + "_embedding_id=feat.get('_embedded_in').id" + ], + "isShown": { + "render": "yes", + "mappings": [ + { + "if": { + "and": [ + "_embedding_nr:={HUISNR}", + "_embedding_street:={STRAATNM}" + ] + }, + "then": "no" + } + ] + }, + "tagRenderings+": [ { - "if": { + "id": "render_embedded", + "render": "Het omliggende object met addres heeft {_embedding_street} {_embedding_nr}", + "condition": { "and": [ - "_embedding_nr:={HUISNR}", - "_embedding_street:={STRAATNM}" + "_embedding_street~*", + "_embedding_nr~*" ] - }, - "then": "no" + } + }, + { + "id": "import-button", + "render": "{import_button(OSM-buildings, addr:street=$STRAATNM; addr:housenumber=$HUISNR,Import this address,,,OSM-buildings,5)}" + }, + { + "id": "apply-button", + "render": "{tag_apply(addr:street=$STRAATNM; addr:housenumber=$HUISNR,Apply this address on the OSM-building,,_embedding_id)}", + "condition": "_embedded_in!=" } ] - }, - "tagRenderings": [ - { - "id": "render_crab", - "render": "Volgens het CRAB ligt hier {STRAATNM} {HUISNR} (label: {HNRLABEL})" - }, - { - "id": "render_embedded", - "render": "Het omliggende object met addres heeft {_embedding_street} {_embedding_nr}", - "condition": { - "and": [ - "_embedding_street~*", - "_embedding_nr~*" - ] - } - }, - "all_tags", - { - "id": "import-button", - "render": "{import_button(OSM-buildings, addr:street=$STRAATNM; addr:housenumber=$HUISNR,Import this address,,,OSM-buildings,5)}" - }, - { - "id": "apply-button", - "render": "{tag_apply(addr:street=$STRAATNM; addr:housenumber=$HUISNR,Apply this address on the OSM-building,,_embedding_id)}", - "condition": "_embedded_in!=" - } - ] + } }, { "id": "GRB", @@ -523,7 +499,8 @@ } } ] - } + }, + "address" ], "hideFromOverview": true, "defaultBackgroundId": "AGIVFlandersGRB", diff --git a/assets/themes/grb_import/grb_fixme.json b/assets/themes/grb_import/grb_fixme.json new file mode 100644 index 000000000..59261e7ae --- /dev/null +++ b/assets/themes/grb_import/grb_fixme.json @@ -0,0 +1,305 @@ +{ + + "id": "grb_fixme", + "title": { + "nl": "GRB Fixup" + }, + "shortDescription": { + "nl": "Grb Fixup" + }, + "description": { + "nl": "Gebouwen met een FIXME - wss GRB-import die gefixed moeten worden" + }, + "language": [ + "nl" + ], + "maintainer": "", + "icon": "./assets/svg/bug.svg", + "version": "0", + "startLat": 51.2132, + "startLon": 3.231, + "startZoom": 14, + "widenFactor": 2, + "socialImage": "", + "clustering": { + "maxZoom": 15 + }, + "overrideAll": { + "source": { + "maxCacheAge": 0 + } + }, + "enableGeolocation": false, + "layers": [ + { + "id": "OSM-buildings-fixme", + "name": "OSM-buildings with a fixme", + "source": { + "osmTags": {"and": + ["building~*","fixme~*"] + }, + "maxCacheAge": 0 + }, + "calculatedTags": [ + "_grbNumber=(feat.properties.fixme?.match(/GRB thinks that this has number ([0-9a-zA-Z;]+)/) ?? ['','none']) [1]" + ], + "mapRendering": [ + { + "width": { + "render": "2", + "mappings": [ + { + "if": "fixme~*", + "then": "5" + } + ] + }, + "color": { + "render": "#00c", + "mappings": [ + { + "if": "fixme~*", + "then": "#ff00ff" + }, + { + "if": "building=house", + "then": "#a00" + }, + { + "if": "building=shed", + "then": "#563e02" + }, + { + "if": { + "or": [ + "building=garage", + "building=garages" + ] + }, + "then": "#f9bfbb" + }, + { + "if": "building=yes", + "then": "#0774f2" + } + ] + } + }, + { + "location": [ + "point", + "centroid" + ], + "label": { + "mappings": [ + { + "if": "addr:housenumber~*", + "then": "
{addr:housenumber}
" + } + ] + }, + "iconSize": { + "render": "40,40,center" + } + } + ], + "title": "OSM-gebouw", + "tagRenderings": [ + { + "id": "building type", + "freeform": { + "key": "building" + }, + "render": "The building type is {building}", + "question": { + "en": "What kind of building is this?" + }, + "mappings": [ + { + "if": "building=house", + "then": "A normal house" + }, + { + "if": "building=detached", + "then": "A house detached from other building" + }, + { + "if": "building=semidetached_house", + "then": "A house sharing only one wall with another house" + }, + { + "if": "building=apartments", + "then": "An apartment building - highrise for living" + }, + { + "if": "building=office", + "then": "An office building - highrise for work" + }, + { + "if": "building=apartments", + "then": "An apartment building" + }, + { + "if": "building=shed", + "then": "A small shed, e.g. in a garden" + }, + { + "if": "building=garage", + "then": "A single garage to park a car" + }, + { + "if": "building=garages", + "then": "A building containing only garages; typically they are all identical" + }, + { + "if": "building=yes", + "then": "A building - no specification" + } + ] + }, + { + "id": "grb-housenumber", + "render": { + "nl": "Het huisnummer is {addr:housenumber}" + }, + "question": { + "nl": "Wat is het huisnummer?" + }, + "freeform": { + "key": "addr:housenumber" + }, + "mappings": [ + { + "if": { + "and": [ + "not:addr:housenumber=yes", + "addr:housenumber=" + ] + }, + "then": { + "nl": "Geen huisnummer" + } + }, + { + "if": { + "and": [ + "addr:housenumber:={_grbNumber}", + "fixme=" + ] + }, + "then": "Het huisnummer is {_grbNumber}, wat overeenkomt met het GRB", + "hideInAnswer": { + "or": [ + "_grbNumber=", + "_grbNumber=none", + "_grbNumber=no number" + ] + } + }, + { + "if": { + "and": [ + "addr:housenumber=", + "not:addr:housenumber=yes", + "fixme=" + ] + }, + "then": "Dit gebouw heeft geen nummer, net zoals in het GRB", + "hideInAnswer": "_grbNumber!=no number" + } + ] + }, + { + "id": "grb-unit", + "question": "Wat is de wooneenheid-aanduiding?", + "render": { + "nl": "De wooneenheid-aanduiding is {addr:unit} " + }, + "freeform": { + "key": "addr:unit" + }, + "mappings": [ + { + "if": "addr:unit=", + "then": "Geen wooneenheid-nummer" + } + ] + }, + { + "id": "grb-street", + "render": { + "nl": "De straat is {addr:street}" + }, + "freeform": { + "key": "addr:street" + }, + "question": { + "nl": "Wat is de straat?" + } + }, + { + "id": "grb-fixme", + "render": { + "nl": "De fixme is {fixme}" + }, + "question": { + "nl": "Wat zegt de fixme?" + }, + "freeform": { + "key": "fixme" + }, + "mappings": [ + { + "if": { + "and": [ + "fixme=" + ] + }, + "then": { + "nl": "Geen fixme" + } + } + ] + }, + { + "id": "grb-min-level", + "render": { + "nl": "Dit gebouw begint maar op de {building:min_level} verdieping" + }, + "question": { + "nl": "Hoeveel verdiepingen ontbreken?" + }, + "freeform": { + "key": "building:min_level", + "type": "pnat" + } + }, + "all_tags" + ], + "minzoom": 14 + }, + { + "builtin": "address", + "override": { + "minzoom": 18 + } + }, + { + "builtin":"crab_address", + "override": { + "minzoom": 18, + "+tagRenderings":[ + { + "id": "import-button", + "render": "{import_button(address, addr:street=$STRAATNM; addr:housenumber=$HUISNR,Import this address)}" + } + ] + } + } + ], + "hideFromOverview": true, + "defaultBackgroundId": "AGIVFlandersGRB", + "overpassMaxZoom": 15, + "osmApiTileSize": 17 + +} \ No newline at end of file diff --git a/assets/themes/uk_addresses/uk_addresses.json b/assets/themes/uk_addresses/uk_addresses.json index 73767c201..7a2918f02 100644 --- a/assets/themes/uk_addresses/uk_addresses.json +++ b/assets/themes/uk_addresses/uk_addresses.json @@ -189,39 +189,16 @@ "description": "Alamat" }, { - "id": "addresses", - "name": { - "en": "Known addresses in OSM", - "de": "Bekannte Adressen in OSM" - }, - "minzoom": 18, - "source": { - "osmTags": { - "or": [ - "addr:housenumber~*", - "addr:street~*", - "ref:inspireid~*" - ] - } - }, - "calculatedTags": [ - "_closest_3_street_names=feat.closestn('named_streets',3, 'name').map(f => f.feat.properties.name)", - "_closest_street:0:name=JSON.parse(feat.properties._closest_3_street_names)[0]", - "_closest_street:1:name=JSON.parse(feat.properties._closest_3_street_names)[1]", - "_closest_street:2:name=JSON.parse(feat.properties._closest_3_street_names)[2]" - ], - "title": { - "render": { - "en": "Known address", - "de": "Bekannte Adresse" - } - }, - "description": { - "en": "Addresses", - "nl": "Adressen", - "de": "Adressen", - "ru": "Адреса" + "builtin": "address", + "override": { + "calculatedTags": [ + "_closest_3_street_names=feat.closestn('named_streets',3, 'name').map(f => f.feat.properties.name)", + "_closest_street:0:name=JSON.parse(feat.properties._closest_3_street_names)[0]", + "_closest_street:1:name=JSON.parse(feat.properties._closest_3_street_names)[1]", + "_closest_street:2:name=JSON.parse(feat.properties._closest_3_street_names)[2]" + ] }, + "tagRenderings": [ { "id": "uk_addresses_explanation_osm", @@ -348,59 +325,6 @@ "en": "{image_carousel(image:address)}
{image_upload(image:address, Add image of the address)}" } } - ], - "mapRendering": [ - { - "icon": { - "render": "./assets/themes/uk_addresses/housenumber_ok.svg", - "mappings": [ - { - "if": { - "or": [ - { - "and": [ - "addr:housenumber=", - "nohousenumber!=yes" - ] - }, - "addr:street=" - ] - }, - "then": "./assets/themes/uk_addresses/housenumber_unknown.svg" - } - ] - }, - "iconSize": { - "render": "40,40,center" - }, - "location": [ - "point" - ] - }, - { - "color": { - "render": "#00f", - "mappings": [ - { - "if": { - "or": [ - { - "and": [ - "addr:housenumber=", - "nohousenumber!=yes" - ] - }, - "addr:street=" - ] - }, - "then": "#ff0" - } - ] - }, - "width": { - "render": "8" - } - } ] }, { diff --git a/css/index-tailwind-output.css b/css/index-tailwind-output.css index 7f7961c21..82d7201ff 100644 --- a/css/index-tailwind-output.css +++ b/css/index-tailwind-output.css @@ -864,18 +864,22 @@ video { margin-left: 0.75rem; } -.mt-1 { - margin-top: 0.25rem; -} - .mt-4 { margin-top: 1rem; } +.mt-1 { + margin-top: 0.25rem; +} + .mr-4 { margin-right: 1rem; } +.mt-2 { + margin-top: 0.5rem; +} + .ml-2 { margin-left: 0.5rem; } @@ -892,10 +896,6 @@ video { margin-right: 0.5rem; } -.mt-2 { - margin-top: 0.5rem; -} - .mb-10 { margin-bottom: 2.5rem; } @@ -1503,11 +1503,6 @@ video { line-height: 1.75rem; } -.text-3xl { - font-size: 1.875rem; - line-height: 2.25rem; -} - .text-2xl { font-size: 1.5rem; line-height: 2rem; @@ -1518,6 +1513,11 @@ video { line-height: 1.75rem; } +.text-3xl { + font-size: 1.875rem; + line-height: 2.25rem; +} + .text-sm { font-size: 0.875rem; line-height: 1.25rem; diff --git a/package.json b/package.json index 1c38328fc..6eaf28141 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "start": "npm run start:prepare && npm-run-all --parallel start:parallel:*", "strt": "npm run start:prepare && npm run start:parallel:parcel", "start:prepare": "ts-node scripts/generateLayerOverview.ts --no-fail && npm run increase-memory", - "start:parallel:parcel": "node --max_old_space_size=8000 $(which parcel) serve *.html UI/** Logic/** assets/*.json assets/svg/* assets/generated/* assets/layers/*/*.svg assets/layers/*/*.jpg assets/layers/*/*.png assets/layers/*/*.css assets/tagRenderings/*.json assets/themes/*/*.svg assets/themes/*/*.css assets/themes/*/*.jpg assets/themes/*/*.png vendor/* vendor/*/*", + "start:parallel:parcel": "node --max_old_space_size=12000 $(which parcel) serve *.html UI/** Logic/** assets/*.json assets/svg/* assets/generated/* assets/layers/*/*.svg assets/layers/*/*.jpg assets/layers/*/*.png assets/layers/*/*.css assets/tagRenderings/*.json assets/themes/*/*.svg assets/themes/*/*.css assets/themes/*/*.jpg assets/themes/*/*.png vendor/* vendor/*/*", "start:parallel:tailwindcli": "tailwindcss -i index.css -o css/index-tailwind-output.css --watch", "generate:css": "tailwindcss -i index.css -o css/index-tailwind-output.css", "test": "ts-node test/TestAll.ts",