forked from MapComplete/MapComplete
Fix: improve functionality of GRB-theme (WIP)
This commit is contained in:
parent
66f2999422
commit
b86e2910ba
10 changed files with 270 additions and 241 deletions
|
@ -156,12 +156,14 @@ class IntersectionFunc implements ExtraFunction {
|
|||
if (otherLayers.length === 0) {
|
||||
continue
|
||||
}
|
||||
for (const otherFeature of otherLayers) {
|
||||
const intersections = GeoOperations.LineIntersections(feat, <any> otherFeature)
|
||||
if (intersections.length === 0) {
|
||||
continue
|
||||
for (const otherFeatures of otherLayers) {
|
||||
for (const otherFeature of otherFeatures) {
|
||||
const intersections = GeoOperations.LineIntersections(feat, <Feature<any, Record<string, string>>>otherFeature)
|
||||
if (intersections.length === 0) {
|
||||
continue
|
||||
}
|
||||
result.push({feat: otherFeature, intersections})
|
||||
}
|
||||
result.push({feat: otherFeature, intersections})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,13 +65,13 @@ export default class GeoJsonSource implements FeatureSource {
|
|||
return
|
||||
}
|
||||
this.LoadJSONFrom(url, eventsource, layer)
|
||||
.then((_) => console.log("Loaded geojson " + url))
|
||||
.then((fs) => console.log("Loaded",fs.length, "features from", url))
|
||||
.catch((err) => console.error("Could not load ", url, "due to", err))
|
||||
return true // data is loaded, we can safely unregister
|
||||
})
|
||||
} else {
|
||||
this.LoadJSONFrom(url, eventsource, layer)
|
||||
.then((_) => console.log("Loaded geojson " + url))
|
||||
.then((fs) => console.log("Loaded",fs.length, "features from", url))
|
||||
.catch((err) => console.error("Could not load ", url, "due to", err))
|
||||
}
|
||||
this.features = eventsource
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
import GeoJsonSource from "./GeoJsonSource"
|
||||
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig"
|
||||
import { FeatureSource } from "../FeatureSource"
|
||||
import { Or } from "../../Tags/Or"
|
||||
import {FeatureSource} from "../FeatureSource"
|
||||
import {Or} from "../../Tags/Or"
|
||||
import FeatureSwitchState from "../../State/FeatureSwitchState"
|
||||
import OverpassFeatureSource from "./OverpassFeatureSource"
|
||||
import { ImmutableStore, Store, UIEventSource } from "../../UIEventSource"
|
||||
import {Store, UIEventSource} from "../../UIEventSource"
|
||||
import OsmFeatureSource from "./OsmFeatureSource"
|
||||
import FeatureSourceMerger from "./FeatureSourceMerger"
|
||||
import DynamicGeoJsonTileSource from "../TiledFeatureSource/DynamicGeoJsonTileSource"
|
||||
import { BBox } from "../../BBox"
|
||||
import {BBox} from "../../BBox"
|
||||
import LocalStorageFeatureSource from "../TiledFeatureSource/LocalStorageFeatureSource"
|
||||
import StaticFeatureSource from "./StaticFeatureSource"
|
||||
import { OsmPreferences } from "../../Osm/OsmPreferences"
|
||||
|
||||
/**
|
||||
* This source will fetch the needed data from various sources for the given layout.
|
||||
|
@ -123,6 +121,8 @@ export default class LayoutSource extends FeatureSourceMerger {
|
|||
bounds,
|
||||
backend,
|
||||
isActive,
|
||||
patchRelations: true
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
|
||||
private readonly _downloadedTiles: Set<number> = new Set<number>()
|
||||
private readonly _downloadedData: Feature[][] = []
|
||||
private readonly _patchRelations: boolean;
|
||||
/**
|
||||
* Downloads data directly from the OSM-api within the given bounds.
|
||||
* All features which match the TagsFilter 'allowedFeatures' are kept and converted into geojson
|
||||
|
@ -33,7 +34,8 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
/**
|
||||
* If given: this featureSwitch will not update if the store contains 'false'
|
||||
*/
|
||||
isActive?: Store<boolean>
|
||||
isActive?: Store<boolean>,
|
||||
patchRelations?: true | boolean
|
||||
}) {
|
||||
super()
|
||||
this._bounds = options.bounds
|
||||
|
@ -41,6 +43,7 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
this.isActive = options.isActive ?? new ImmutableStore(true)
|
||||
this._backend = options.backend ?? "https://www.openstreetmap.org"
|
||||
this._bounds.addCallbackAndRunD((bbox) => this.loadData(bbox))
|
||||
this._patchRelations = options?.patchRelations ?? true
|
||||
}
|
||||
|
||||
private async loadData(bbox: BBox) {
|
||||
|
@ -78,13 +81,13 @@ export default class OsmFeatureSource extends FeatureSourceMerger {
|
|||
* The requested tile might only contain part of the relation.
|
||||
*
|
||||
* This method will download the full relation and return it as geojson if it was incomplete.
|
||||
* If the feature is already complete (or is not a relation), the feature will be returned
|
||||
* If the feature is already complete (or is not a relation), the feature will be returned as is
|
||||
*/
|
||||
private async patchIncompleteRelations(
|
||||
feature: { properties: { id: string } },
|
||||
originalJson: { elements: { type: "node" | "way" | "relation"; id: number }[] }
|
||||
): Promise<any> {
|
||||
if (!feature.properties.id.startsWith("relation")) {
|
||||
if (!feature.properties.id.startsWith("relation") || !this._patchRelations) {
|
||||
return feature
|
||||
}
|
||||
const relationSpec = originalJson.elements.find(
|
||||
|
|
|
@ -25,6 +25,7 @@ export default class DynamicGeoJsonTileSource extends DynamicTileSource {
|
|||
if (source.geojsonSource === undefined) {
|
||||
throw "Invalid layer: geojsonSource expected"
|
||||
}
|
||||
console.log("Creating a dynamic geojson source for", layer.source.geojsonSource)
|
||||
|
||||
let whitelist = undefined
|
||||
if (source.geojsonSource.indexOf("{x}_{y}.geojson") > 0) {
|
||||
|
|
|
@ -139,7 +139,7 @@ export interface LayerConfigJson {
|
|||
forceLoad?: false | boolean
|
||||
|
||||
/**
|
||||
* The minimum needed zoomlevel required before loading of the data start
|
||||
* The minimum needed zoomlevel required before loading the data
|
||||
* Default: 0
|
||||
*/
|
||||
minzoom?: number
|
||||
|
|
|
@ -671,9 +671,12 @@ export class ImportPointButton extends AbstractImportButton {
|
|||
) {
|
||||
originalFeatureTags.data["_imported"] = "yes"
|
||||
originalFeatureTags.ping() // will set isImported as per its definition
|
||||
let snapOnto: OsmObject = undefined
|
||||
let snapOnto: OsmObject | "deleted" = undefined
|
||||
if (snapOntoWayId !== undefined) {
|
||||
snapOnto = await OsmObject.DownloadObjectAsync(snapOntoWayId)
|
||||
snapOnto = await state.osmObjectDownloader.DownloadObjectAsync(snapOntoWayId)
|
||||
}
|
||||
if(snapOnto === "deleted"){
|
||||
return new FixedUiElement("Error - way is deleted. Refresh the page").SetClass("alert")
|
||||
}
|
||||
let specialMotivation = undefined
|
||||
|
||||
|
@ -746,7 +749,7 @@ export class ImportPointButton extends AbstractImportButton {
|
|||
const [lon, lat] = <[number, number]>feature.geometry.coordinates
|
||||
return new ConfirmLocationOfPoint(
|
||||
state,
|
||||
state.guistate.filterViewIsOpened,
|
||||
state.guistate.themeIsOpened ,
|
||||
presetInfo,
|
||||
Translations.W(args.text),
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
specs = SpecialVisualizations.constructSpecification(txt);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Could not construct a specification and with arguments", txt);
|
||||
console.error("Could not construct a specification and with arguments", txt,"due to",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
try {
|
||||
return specpart.func.constr(state, tags, specpart.args, feature, layer);
|
||||
} catch (e) {
|
||||
console.error("Could not construct a special visualisation with specification", specpart, "and tags", tags);
|
||||
console.error("Could not construct a special visualisation with specification", specpart, "and tags", tags,"due to", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
},
|
||||
"minzoom": 19,
|
||||
"calculatedTags": [
|
||||
"_surface:strict:=feat.get('_surface')"
|
||||
"_surface:strict:=feat(get)('_surface')"
|
||||
],
|
||||
"mapRendering": [
|
||||
{
|
||||
|
@ -193,19 +193,19 @@
|
|||
"minzoom": 19,
|
||||
"calculatedTags": [
|
||||
"_overlaps_with_buildings=overlapWith(feat)('osm:buildings').filter(f => f.feat.properties.id.indexOf('-') < 0)",
|
||||
"_overlaps_with=feat.get('_overlaps_with_buildings').find(f => f.overlap > 1 /* square meter */ )",
|
||||
"_overlaps_with_properties=feat.get('_overlaps_with')?.feat?.properties",
|
||||
"_overlap_percentage=Math.round(100 * (feat.get('_overlaps_with')?.overlap / feat.get('_overlaps_with_properties')['_surface:strict']))",
|
||||
"_reverse_overlap_percentage=Math.round(100 * (feat.get('_overlaps_with')?.overlap / feat.get('_surface')))",
|
||||
"_overlaps_with=feat(get)('_overlaps_with_buildings').find(f => f.overlap > 1 /* square meter */ )",
|
||||
"_overlaps_with_properties=feat(get)('_overlaps_with')?.feat?.properties",
|
||||
"_overlap_percentage=Math.round(100 * (feat(get)('_overlaps_with')?.overlap / feat(get)('_overlaps_with_properties')['_surface:strict']))",
|
||||
"_reverse_overlap_percentage=Math.round(100 * (feat(get)('_overlaps_with')?.overlap / feat(get)('_surface')))",
|
||||
"_bag_obj:in_construction=feat.properties.status.startsWith('Bouwvergunning verleend') || feat.properties.status.startsWith('Bouw gestart')",
|
||||
"_bag_obj:construction=(feat.properties.gebruiksdoel == 'woonfunctie') ? ((Number(feat.properties.aantal_verblijfsobjecten) == 1) ? 'house' : 'apartments') : 'yes'",
|
||||
"_bag_obj:building=(feat.properties.status.startsWith('Bouwvergunning verleend') || feat.properties.status.startsWith('Bouw gestart')) ? 'construction' : feat.properties['_bag_obj:construction']",
|
||||
"_bag_obj:ref:bag=Number(feat.properties.identificatie)",
|
||||
"_bag_obj:source:date=new Date().toISOString().split('T')[0]",
|
||||
"_bag_obj:start_date=feat.properties.bouwjaar",
|
||||
"_osm_obj:id=feat.get('_overlaps_with_properties')?.id",
|
||||
"_osm_obj:building=feat.get('_overlaps_with_properties')?.building",
|
||||
"_imported_osm_object_found:=Number(feat.properties.identificatie)==Number(feat.get('_overlaps_with_properties')['ref:bag'])"
|
||||
"_osm_obj:id=feat(get)('_overlaps_with_properties')?.id",
|
||||
"_osm_obj:building=feat(get)('_overlaps_with_properties')?.building",
|
||||
"_imported_osm_object_found:=Number(feat.properties.identificatie)==Number(feat(get)('_overlaps_with_properties')['ref:bag'])"
|
||||
],
|
||||
"mapRendering": [
|
||||
{
|
||||
|
@ -369,11 +369,11 @@
|
|||
"_bag_obj:addr:housenumber=`${feat.properties.huisnummer}${feat.properties.huisletter}${(feat.properties.toevoeging != '') ? '-' : ''}${feat.properties.toevoeging}`",
|
||||
"_bag_obj:ref:bag=Number(feat.properties.identificatie)",
|
||||
"_bag_obj:source:date=new Date().toISOString().split('T')[0]",
|
||||
"_osm_obj:addr:city:=feat.get('_closed_osm_addr')['addr:city']",
|
||||
"_osm_obj:addr:housenumber:=feat.get('_closed_osm_addr')['addr:housenumber']",
|
||||
"_osm_obj:addr:postcode:=feat.get('_closed_osm_addr')['addr:postcode']",
|
||||
"_osm_obj:addr:street:=feat.get('_closed_osm_addr')['addr:street']",
|
||||
"_imported_osm_object_found:=(feat.properties.woonplaats==feat.get('_closed_osm_addr')['addr:city'])&&(feat.get('_bag_obj:addr:housenumber')==feat.get('_closed_osm_addr')['addr:housenumber'])&&(feat.properties.postcode==feat.get('_closed_osm_addr')['addr:postcode'])&&(feat.properties.openbare_ruimte==feat.get('_closed_osm_addr')['addr:street'])"
|
||||
"_osm_obj:addr:city:=feat(get)('_closed_osm_addr')['addr:city']",
|
||||
"_osm_obj:addr:housenumber:=feat(get)('_closed_osm_addr')['addr:housenumber']",
|
||||
"_osm_obj:addr:postcode:=feat(get)('_closed_osm_addr')['addr:postcode']",
|
||||
"_osm_obj:addr:street:=feat(get)('_closed_osm_addr')['addr:street']",
|
||||
"_imported_osm_object_found:=(feat.properties.woonplaats==feat(get)('_closed_osm_addr')['addr:city'])&&(feat(get)('_bag_obj:addr:housenumber')==feat(get)('_closed_osm_addr')['addr:housenumber'])&&(feat.properties.postcode==feat(get)('_closed_osm_addr')['addr:postcode'])&&(feat.properties.openbare_ruimte==feat(get)('_closed_osm_addr')['addr:street'])"
|
||||
],
|
||||
"mapRendering": [
|
||||
{
|
||||
|
|
|
@ -26,18 +26,28 @@
|
|||
"maxZoom": 15
|
||||
},
|
||||
"overrideAll": {
|
||||
"minzoom": 19
|
||||
"minzoom": 17
|
||||
},
|
||||
"layers": [
|
||||
{
|
||||
"id": "osm-buildings",
|
||||
"name": "All OSM-buildings",
|
||||
"source": {
|
||||
"osmTags": "building~*",
|
||||
"osmTags": {
|
||||
"and": [
|
||||
{
|
||||
"or": [
|
||||
"id~way/.*",
|
||||
"id~relation/.*"
|
||||
]
|
||||
},
|
||||
"building~*"
|
||||
]
|
||||
},
|
||||
"maxCacheAge": 0
|
||||
},
|
||||
"calculatedTags": [
|
||||
"_surface:strict:=feat.get('_surface')"
|
||||
"_surface:strict:=get(feat)('_surface')"
|
||||
],
|
||||
"mapRendering": [
|
||||
{
|
||||
|
@ -192,6 +202,13 @@
|
|||
"nl": "Wat is de straat?"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "grb-reference",
|
||||
"render": {
|
||||
"en": "Has been imported from GRB, reference number is {source:geometry:ref}"
|
||||
},
|
||||
"condition": "source:geometry:ref~*"
|
||||
},
|
||||
{
|
||||
"id": "grb-fixme",
|
||||
"render": {
|
||||
|
@ -257,202 +274,13 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "service_ways",
|
||||
"name": "Service roads",
|
||||
"description": "A seperate layer with service roads, as to remove them from the intersection testing",
|
||||
"source": {
|
||||
"osmTags": "highway=service"
|
||||
},
|
||||
"mapRendering": [
|
||||
{
|
||||
"width": 4,
|
||||
"color": "#888888"
|
||||
}
|
||||
],
|
||||
"title": {
|
||||
"render": "Service road"
|
||||
},
|
||||
"tagRenderings": []
|
||||
},
|
||||
{
|
||||
"id": "generic_osm_object",
|
||||
"name": "All OSM Objects",
|
||||
"source": {
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"id~*",
|
||||
"place=",
|
||||
"disused:power=",
|
||||
"power=",
|
||||
"type!=boundary",
|
||||
"boundary=",
|
||||
{
|
||||
"or": [
|
||||
"level=",
|
||||
"level=0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"or": [
|
||||
"layer=0",
|
||||
"layer="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxCacheAge": 0
|
||||
},
|
||||
"mapRendering": [
|
||||
{
|
||||
"color": {
|
||||
"render": "#ccc"
|
||||
},
|
||||
"width": {
|
||||
"render": "1"
|
||||
},
|
||||
"fill": "no"
|
||||
}
|
||||
],
|
||||
"title": {
|
||||
"render": {
|
||||
"*": "Other OSM-Object"
|
||||
}
|
||||
},
|
||||
"tagRenderings": [
|
||||
"all_tags"
|
||||
]
|
||||
},
|
||||
"address",
|
||||
{
|
||||
"builtin": "crab_address",
|
||||
"override": {
|
||||
"calculatedTags+": [
|
||||
"_embedded_in=overlapWith(feat)('osm-buildings').filter(b => /* Do not match newly created objects */ b.feat.properties.id.indexOf('-') < 0)[0]?.feat?.properties ?? {}",
|
||||
"_embedding_nr=feat.get('_embedded_in')['addr:housenumber']+(feat.get('_embedded_in')['addr:unit'] ?? '')",
|
||||
"_embedding_street=feat.get('_embedded_in')['addr:street']",
|
||||
"_embedding_id=feat.get('_embedded_in').id",
|
||||
"_closeby_addresses=closestn(feat)('address',10,undefined,50).map(f => f.feat).filter(addr => addr.properties['addr:street'] == feat.properties['STRAATNM'] && feat.properties['HNRLABEL'] == addr.properties['addr:housenumber'] + (addr.properties['addr:unit']??'') ).length",
|
||||
"_has_identical_closeby_address=feat.get('_closeby_addresses') >= 1 ? 'yes' : 'no'",
|
||||
"_embedded_in_grb=overlapWith(feat)('grb')[0]?.feat?.properties ?? {}",
|
||||
"_embedding_nr_grb=feat.get('_embedded_in_grb')['addr:housenumber']",
|
||||
"_embedding_street_grb=feat.get('_embedded_in_grb')['addr:street']"
|
||||
],
|
||||
"filter": [
|
||||
{
|
||||
"id": "show_matched_addresses",
|
||||
"options": [
|
||||
{
|
||||
"question": "Show all CRAB-addresses (including already matched ones)"
|
||||
},
|
||||
{
|
||||
"question": "Only show unmatched addresses",
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"_has_identical_closeby_address!=yes",
|
||||
{
|
||||
"#": "Matches the embedding OSM object",
|
||||
"or": [
|
||||
"_embedding_nr!:={HUISNR}",
|
||||
"_embedding_street!:={STRAATNM}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"#": "Matches the embedding GRB object",
|
||||
"or": [
|
||||
"_embedding_nr_grb!:={HUISNR}",
|
||||
"_embedding_street_grb!:={STRAATNM}"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tagRenderings+": [
|
||||
{
|
||||
"id": "render_embedded",
|
||||
"render": "Dit CRAB-adres ligt in <a href='https://osm.org/{_embedding_id}' target='_blank'>OSM-gebouw {_embedding_id}</a>",
|
||||
"mappings": [
|
||||
{
|
||||
"if": "_embedding_id=",
|
||||
"then": {
|
||||
"nl": "Geen omliggend OSM-gebouw gevonden"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "embedded_address",
|
||||
"render": "Het omliggende OSM-gebouw heeft geen volledig address",
|
||||
"mappings": [
|
||||
{
|
||||
"if": {
|
||||
"and": [
|
||||
"_embedding_street~*",
|
||||
"_embedding_nr~*"
|
||||
]
|
||||
},
|
||||
"then": "Het omliggende object met addres heeft <b>{_embedding_street}</b> {_embedding_nr}"
|
||||
}
|
||||
],
|
||||
"condition": "_embedding_id~*"
|
||||
},
|
||||
{
|
||||
"id": "apply-button",
|
||||
"render": "{tag_apply(addr:street=$STRAATNM; addr:housenumber=$_HNRLABEL,Apply this address on the OSM-building,,_embedding_id)}",
|
||||
"condition": {
|
||||
"and": [
|
||||
"_embedding_id!=",
|
||||
{
|
||||
"or": [
|
||||
"_embedding_street!:={STRAATNM}",
|
||||
"_embedding_nr!:={_HNRLABEL}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "import-button",
|
||||
"render": {
|
||||
"special": {
|
||||
"type": "import_button",
|
||||
"targetLayer": "address",
|
||||
"tags": "addr:street=$STRAATNM; addr:housenumber=$_HNRLABEL",
|
||||
"text": {
|
||||
"nl": "Voeg dit adres als een nieuw adrespunt toe"
|
||||
},
|
||||
"snap_onto_layers": "osm-buildings"
|
||||
}
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"if": "_embedding_id=",
|
||||
"then": {
|
||||
"nl": "Geen omliggend OSM-gebouw gevonden. Een omliggend gebouw is nodig om dit punt als adres punt toe te voegen. <div class=subtle>Importeer eerst de gebouwen. Vernieuw dan de pagina om losse adressen toe te voegen</div>"
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"or": [
|
||||
"_embedding_street!:={STRAATNM}",
|
||||
"_embedding_nr!:={_HNRLABEL}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "grb",
|
||||
"description": "Geometry which comes from GRB with tools to import them",
|
||||
"source": {
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"HUISNR~*",
|
||||
"osm_id~*",
|
||||
"man_made!=mast"
|
||||
]
|
||||
},
|
||||
|
@ -466,17 +294,17 @@
|
|||
"title": "GRB outline",
|
||||
"calculatedTags": [
|
||||
"_overlaps_with_buildings=overlapWith(feat)('osm-buildings').filter(f => f.feat.properties.id.indexOf('-') < 0)",
|
||||
"_overlaps_with=feat.get('_overlaps_with_buildings').find(f => f.overlap > 1 /* square meter */ )",
|
||||
"_osm_obj:source:ref=feat.get('_overlaps_with')?.feat?.properties['source:geometry:ref']",
|
||||
"_osm_obj:id=feat.get('_overlaps_with')?.feat?.properties?.id",
|
||||
"_osm_obj:source:date=(feat.get('_overlaps_with')?.feat?.properties ?? {})['source:geometry:date']?.replace(/\\//g, '-')",
|
||||
"_osm_obj:building=feat.get('_overlaps_with')?.feat?.properties?.building",
|
||||
"_osm_obj:addr:street=(feat.get('_overlaps_with')?.feat?.properties ?? {})['addr:street']",
|
||||
"_osm_obj:addr:housenumber=(feat.get('_overlaps_with')?.feat?.properties ?? {})['addr:housenumber']",
|
||||
"_osm_obj:surface=(feat.get('_overlaps_with')?.feat?.properties ?? {})['_surface:strict']",
|
||||
"_overlap_absolute=feat.get('_overlaps_with')?.overlap",
|
||||
"_reverse_overlap_percentage=Math.round(100 * feat.get('_overlap_absolute') / feat.get('_surface'))",
|
||||
"_overlap_percentage=Math.round(100 * feat.get('_overlap_absolute') / feat.get('_osm_obj:surface'))",
|
||||
"_overlaps_with=get(feat)('_overlaps_with_buildings').find(f => f.overlap > 1 /* square meter */ )",
|
||||
"_osm_obj:source:ref=get(feat)('_overlaps_with')?.feat?.properties['source:geometry:ref']",
|
||||
"_osm_obj:id=get(feat)('_overlaps_with')?.feat?.properties?.id",
|
||||
"_osm_obj:source:date=(get(feat)('_overlaps_with')?.feat?.properties ?? {})['source:geometry:date']?.replace(/\\//g, '-')",
|
||||
"_osm_obj:building=get(feat)('_overlaps_with')?.feat?.properties?.building",
|
||||
"_osm_obj:addr:street=(get(feat)('_overlaps_with')?.feat?.properties ?? {})['addr:street']",
|
||||
"_osm_obj:addr:housenumber=(get(feat)('_overlaps_with')?.feat?.properties ?? {})['addr:housenumber']",
|
||||
"_osm_obj:surface=(get(feat)('_overlaps_with')?.feat?.properties ?? {})['_surface:strict']",
|
||||
"_overlap_absolute=get(feat)('_overlaps_with')?.overlap",
|
||||
"_reverse_overlap_percentage=Math.round(100 * get(feat)('_overlap_absolute') / get(feat)('_surface'))",
|
||||
"_overlap_percentage=Math.round(100 * get(feat)('_overlap_absolute') / get(feat)('_osm_obj:surface'))",
|
||||
"_grb_ref=feat.properties['source:geometry:entity'] + '/' + feat.properties['source:geometry:oidn']",
|
||||
"_imported_osm_object_found= feat.properties['_osm_obj:source:ref'] == feat.properties._grb_ref",
|
||||
"_grb_date=feat.properties['source:geometry:date'].replace(/\\//g,'-')",
|
||||
|
@ -695,13 +523,205 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"id": "service_ways",
|
||||
"name": "Service roads",
|
||||
"description": "A seperate layer with service roads, as to remove them from the intersection testing",
|
||||
"source": {
|
||||
"osmTags": "highway=service"
|
||||
},
|
||||
"mapRendering": [
|
||||
{
|
||||
"width": 4,
|
||||
"color": "#888888"
|
||||
}
|
||||
],
|
||||
"title": {
|
||||
"render": "Service road"
|
||||
},
|
||||
"tagRenderings": []
|
||||
},
|
||||
{
|
||||
"id": "generic_osm_object",
|
||||
"name": "All OSM Objects",
|
||||
"source": {
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"id~*",
|
||||
"place=",
|
||||
"disused:power=",
|
||||
"power=",
|
||||
"type!=boundary",
|
||||
"type!=route",
|
||||
"type!=waterway",
|
||||
"boundary=",
|
||||
{
|
||||
"or": [
|
||||
"level=",
|
||||
"level=0"
|
||||
]
|
||||
},
|
||||
{
|
||||
"or": [
|
||||
"layer=0",
|
||||
"layer="
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"maxCacheAge": 0
|
||||
},
|
||||
"mapRendering": [
|
||||
{
|
||||
"color": {
|
||||
"render": "#ccc"
|
||||
},
|
||||
"width": {
|
||||
"render": "1"
|
||||
},
|
||||
"fill": "no"
|
||||
}
|
||||
],
|
||||
"title": {
|
||||
"render": {
|
||||
"*": "Other OSM-Object"
|
||||
}
|
||||
},
|
||||
"tagRenderings": [
|
||||
"all_tags"
|
||||
]
|
||||
},
|
||||
"address",
|
||||
{
|
||||
"builtin": "crab_address",
|
||||
"override": {
|
||||
"calculatedTags+": [
|
||||
"_embedded_in=overlapWith(feat)('osm-buildings').filter(b => /* Do not match newly created objects */ b.feat.properties.id.indexOf('-') < 0)[0]?.feat?.properties ?? {}",
|
||||
"_embedding_nr=get(feat)('_embedded_in')['addr:housenumber']+(get(feat)('_embedded_in')['addr:unit'] ?? '')",
|
||||
"_embedding_street=get(feat)('_embedded_in')['addr:street']",
|
||||
"_embedding_id=get(feat)('_embedded_in').id",
|
||||
"_closeby_addresses=closestn(feat)('address',10,undefined,50).map(f => f.feat).filter(addr => addr.properties['addr:street'] == feat.properties['STRAATNM'] && feat.properties['HNRLABEL'] == addr.properties['addr:housenumber'] + (addr.properties['addr:unit']??'') ).length",
|
||||
"_has_identical_closeby_address=get(feat)('_closeby_addresses') >= 1 ? 'yes' : 'no'",
|
||||
"_embedded_in_grb=overlapWith(feat)('grb')[0]?.feat?.properties ?? {}",
|
||||
"_embedding_nr_grb=get(feat)('_embedded_in_grb')['addr:housenumber']",
|
||||
"_embedding_street_grb=get(feat)('_embedded_in_grb')['addr:street']"
|
||||
],
|
||||
"filter": [
|
||||
{
|
||||
"id": "show_matched_addresses",
|
||||
"options": [
|
||||
{
|
||||
"question": "Show all CRAB-addresses (including already matched ones)"
|
||||
},
|
||||
{
|
||||
"question": "Only show unmatched addresses",
|
||||
"osmTags": {
|
||||
"and": [
|
||||
"_has_identical_closeby_address!=yes",
|
||||
{
|
||||
"#": "Matches the embedding OSM object",
|
||||
"or": [
|
||||
"_embedding_nr!:={HUISNR}",
|
||||
"_embedding_street!:={STRAATNM}"
|
||||
]
|
||||
},
|
||||
{
|
||||
"#": "Matches the embedding GRB object",
|
||||
"or": [
|
||||
"_embedding_nr_grb!:={HUISNR}",
|
||||
"_embedding_street_grb!:={STRAATNM}"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tagRenderings+": [
|
||||
{
|
||||
"id": "render_embedded",
|
||||
"render": "Dit CRAB-adres ligt in <a href='https://osm.org/{_embedding_id}' target='_blank'>OSM-gebouw {_embedding_id}</a>",
|
||||
"mappings": [
|
||||
{
|
||||
"if": "_embedding_id=",
|
||||
"then": {
|
||||
"nl": "Geen omliggend OSM-gebouw gevonden"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "embedded_address",
|
||||
"render": "Het omliggende OSM-gebouw heeft geen volledig address",
|
||||
"mappings": [
|
||||
{
|
||||
"if": {
|
||||
"and": [
|
||||
"_embedding_street~*",
|
||||
"_embedding_nr~*"
|
||||
]
|
||||
},
|
||||
"then": "Het omliggende object met addres heeft <b>{_embedding_street}</b> {_embedding_nr}"
|
||||
}
|
||||
],
|
||||
"condition": "_embedding_id~*"
|
||||
},
|
||||
{
|
||||
"id": "apply-button",
|
||||
"render": "{tag_apply(addr:street=$STRAATNM; addr:housenumber=$_HNRLABEL,Apply this address on the OSM-building,,_embedding_id)}",
|
||||
"condition": {
|
||||
"and": [
|
||||
"_embedding_id!=",
|
||||
{
|
||||
"or": [
|
||||
"_embedding_street!:={STRAATNM}",
|
||||
"_embedding_nr!:={_HNRLABEL}"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "import-button",
|
||||
"render": {
|
||||
"special": {
|
||||
"type": "import_button",
|
||||
"targetLayer": "address",
|
||||
"tags": "addr:street=$STRAATNM; addr:housenumber=$_HNRLABEL",
|
||||
"text": {
|
||||
"nl": "Voeg dit adres als een nieuw adrespunt toe"
|
||||
},
|
||||
"snap_onto_layers": "osm-buildings"
|
||||
}
|
||||
},
|
||||
"mappings": [
|
||||
{
|
||||
"if": "_embedding_id=",
|
||||
"then": {
|
||||
"nl": "Geen omliggend OSM-gebouw gevonden. Een omliggend gebouw is nodig om dit punt als adres punt toe te voegen. <div class=subtle>Importeer eerst de gebouwen. Vernieuw dan de pagina om losse adressen toe te voegen</div>"
|
||||
}
|
||||
}
|
||||
],
|
||||
"condition": {
|
||||
"or": [
|
||||
"_embedding_street!:={STRAATNM}",
|
||||
"_embedding_nr!:={_HNRLABEL}"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"builtin": "current_view",
|
||||
"override": {
|
||||
"calculatedTags": [
|
||||
"_overlapping=Number(feat.properties.zoom) >= 16 ? overlapWith(feat)('grb').map(ff => ff.feat.properties) : undefined",
|
||||
"_applicable=feat.get('_overlapping')?.filter(p => (p._imported_osm_object_found === 'true' || p._intersects_with_other_features === ''))?.map(p => p.id)",
|
||||
"_applicable_count=feat.get('_applicable')?.length"
|
||||
"_applicable=get(feat)('_overlapping')?.filter(p => (p._imported_osm_object_found === 'true' || p._intersects_with_other_features === ''))?.map(p => p.id)",
|
||||
"_applicable_count=get(feat)('_applicable')?.length"
|
||||
],
|
||||
"tagRenderings+": [
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue