Create a metamap

This commit is contained in:
Pieter Vander Vennet 2020-07-17 13:27:09 +02:00
parent 952a475b6d
commit d7809b88bc
7 changed files with 28985 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import Cyclofix from "./Layouts/Cyclofix";
import { WalkByBrussels } from "./Layouts/WalkByBrussels"; import { WalkByBrussels } from "./Layouts/WalkByBrussels";
import { All } from "./Layouts/All"; import { All } from "./Layouts/All";
import { Layout } from "./Layout"; import { Layout } from "./Layout";
import {MetaMap} from "./Layouts/MetaMap";
export class AllKnownLayouts { export class AllKnownLayouts {
public static allSets: any = AllKnownLayouts.AllLayouts(); public static allSets: any = AllKnownLayouts.AllLayouts();
@ -19,6 +20,7 @@ export class AllKnownLayouts {
new Cyclofix(), new Cyclofix(),
new Bookcases(), new Bookcases(),
new WalkByBrussels(), new WalkByBrussels(),
new MetaMap(),
all all
/*new Toilets(), /*new Toilets(),
new Statues(), new Statues(),

View file

@ -0,0 +1,92 @@
import {LayerDefinition} from "../LayerDefinition";
import FixedText from "../Questions/FixedText";
import {ImageCarouselWithUploadConstructor} from "../../UI/Image/ImageCarouselWithUpload";
import {TagRenderingOptions} from "../TagRendering";
import {And, Tag} from "../../Logic/TagsFilter";
import L from "leaflet";
export class Map extends LayerDefinition {
constructor() {
super();
this.name = "Map";
this.title = new FixedText("Map");
this.minzoom = 12;
this.overpassFilter = new Tag("information", "map");
this.newElementTags = [new Tag("tourism", "information"), new Tag("information", "map")];
const isOsmSource = new Tag("map_source", "OpenStreetMap");
this.style = (properties) => {
let icon = "assets/map.svg";
if(isOsmSource.matchesProperties(properties)){
icon = "assets/osm-logo-white-bg.svg";
const attr = properties["map_source:attribution"];
if(attr == "sticker"){
icon = "assets/map-stickered.svg"
}else if(attr == "no"){
icon = "assets/osm-logo-buggy-attr.svg"
}
}
return {
color: "#000000",
icon: L.icon(
{
iconUrl: icon,
iconSize: [50, 50]
}
)
};
}
this.elementsToShow = [
new ImageCarouselWithUploadConstructor(),
new TagRenderingOptions({
question: "Is this map based on OpenStreetMap?",
mappings: [
{
k: isOsmSource,
txt: "This map is based on OpenStreetMap"
},
],
freeform: {
key: "map_source",
renderTemplate: "The map data is based on {map_source}",
template: "The map data is based on $$$"
}
}),
new TagRenderingOptions({
question: "Is the attribution present?",
mappings: [
{
k: new Tag("map_source:attribution", "yes"),
txt: "OpenStreetMap is clearly attribute, including the ODBL-license"
},
{
k: new Tag("map_source:attribution", "incomplete"),
txt: "OpenStreetMap is clearly attribute, but the license is not mentioned"
},
{
k: new Tag("map_source:attribution", "sticker"),
txt: "OpenStreetMap wasn't mentioned, but someone put an OpenStreetMap-sticker on it"
},
{
k: new Tag("map_source:attribution", "no"),
txt: "There is no attribution at all"
},
]
}).OnlyShowIf(new Tag("map_source", "OpenStreetMap"))
]
}
}

View file

@ -0,0 +1,18 @@
import {Layout} from "../Layout";
import * as Layer from "../Layers/Bookcases";
import {Map} from "../Layers/Map";
export class MetaMap extends Layout{
constructor() {
super( "metamap",
"Open Map Map",
[new Map()],
1,
0,
0,
" <h3>Open Map Map</h3>\n" +
"This map is a map of physical maps, as known by OpenStreetMap.");
}
}

13030
assets/map-stickered.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 469 KiB

9268
assets/map.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 297 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 159 KiB

3282
assets/osm-logo-white-bg.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 156 KiB