Some tweaks
This commit is contained in:
parent
27ccce70c0
commit
739275f8a1
6 changed files with 79 additions and 285 deletions
|
@ -2,7 +2,7 @@ import { TagsFilter } from "../../Logic/Tags/TagsFilter"
|
|||
import { RegexTag } from "../../Logic/Tags/RegexTag"
|
||||
|
||||
export default class SourceConfig {
|
||||
public readonly osmTags?: TagsFilter
|
||||
public osmTags?: TagsFilter
|
||||
public readonly overpassScript?: string
|
||||
public geojsonSource?: string
|
||||
public geojsonZoomLevel?: number
|
||||
|
|
|
@ -7,7 +7,6 @@ import {BBox} from "../Logic/BBox";
|
|||
import Minimap from "../UI/Base/Minimap";
|
||||
import AvailableBaseLayers from "../Logic/Actors/AvailableBaseLayers";
|
||||
import {Utils} from "../Utils";
|
||||
import {FixedUiElement} from "../UI/Base/FixedUiElement";
|
||||
|
||||
export interface PngMapCreatorOptions{
|
||||
readonly divId: string; readonly width: number; readonly height: number; readonly scaling?: 1 | number,
|
||||
|
@ -61,7 +60,6 @@ export class PngMapCreator {
|
|||
// Lets first init the minimap and wait for all background tiles to load
|
||||
const minimap = await this.createAndLoadMinimap()
|
||||
const state = this._state
|
||||
const freediv = this._options.divId
|
||||
const dummyMode = this._options.dummyMode ?? false
|
||||
console.log("Dummy mode is", dummyMode)
|
||||
return new Promise<string | Blob>(resolve => {
|
||||
|
@ -99,10 +97,9 @@ export class PngMapCreator {
|
|||
state: undefined,
|
||||
})
|
||||
})
|
||||
await Utils.waitFor(2500)
|
||||
await Utils.waitFor(10000)
|
||||
}
|
||||
minimap.TakeScreenshot(format).then(result => {
|
||||
new FixedUiElement("Done!").AttachTo(freediv)
|
||||
return resolve(result);
|
||||
})
|
||||
})
|
||||
|
|
|
@ -9,6 +9,9 @@ import "../assets/templates/Ubuntu-M-normal.js"
|
|||
import "../assets/templates/Ubuntu-L-normal.js"
|
||||
import "../assets/templates/UbuntuMono-B-bold.js"
|
||||
import {parseSVG, makeAbsolute} from 'svg-path-parser';
|
||||
import {And} from "../Logic/Tags/And";
|
||||
import {Tag} from "../Logic/Tags/Tag";
|
||||
import LayerConfig from "../Models/ThemeConfig/LayerConfig";
|
||||
|
||||
class SvgToPdfInternals {
|
||||
private readonly doc: jsPDF;
|
||||
|
@ -578,8 +581,19 @@ export class SvgToPdf {
|
|||
throw "Theme not found:" + params["theme"] + ". Use theme: to define which theme to use. "
|
||||
}
|
||||
layout.widenFactor = 0
|
||||
layout.overpassTimeout = 180
|
||||
layout.overpassTimeout = 600
|
||||
layout.defaultBackgroundId = params["background"] ?? layout.defaultBackgroundId
|
||||
for (const paramsKey in params) {
|
||||
if (paramsKey.startsWith("layer-")) {
|
||||
const layerName = paramsKey.substring("layer-".length)
|
||||
const key = params[paramsKey].toLowerCase().trim()
|
||||
const layer = layout.layers.find(l => l.id === layerName)
|
||||
if (key === "force") {
|
||||
console.log("Forcing minzoom of layer",layer.id)
|
||||
layer.minzoom = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
const zoom = Number(params["zoom"] ?? params["z"] ?? 14);
|
||||
|
||||
const state = new FeaturePipelineState(layout)
|
||||
|
@ -608,7 +622,7 @@ export class SvgToPdf {
|
|||
isDisplayed
|
||||
)
|
||||
if (key === "force") {
|
||||
layer.layerDef.minzoom = zoom
|
||||
layer.layerDef.minzoom = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
@ -47,7 +47,7 @@
|
|||
"mapcomplete": {
|
||||
"customize": "MapComplete can tailored to your needs, with new map layers, new functionalities or styled to your organisation styleguide. We also have experience with starting campaigns to crowdsource geodata.\nContact pietervdvn@posteo.net for a quote.",
|
||||
"intro": "MapComplete is a website which has {mapCount} interactive maps. Every single map allows to add or update information.",
|
||||
"li0": "Communicate where POI are",
|
||||
"li0": "Show where POI are",
|
||||
"li1": "Add new points and update information on existing points",
|
||||
"li2": "View and add pictures",
|
||||
"li3": "Add contact information and opening hours easily",
|
||||
|
@ -61,7 +61,7 @@
|
|||
"osm": "OpenStreetMap is an online map which can be edited and reused by anyone for any purpose as long as attribution is given and the data is kept open.\n\nIt is the biggest geospatial database in the world and is reused by thousands of applications and websites.",
|
||||
"tagline": "Collect geodata easily with OpenStreetMap",
|
||||
"title": "MapComplete.osm.be",
|
||||
"toerisme_vlaanderen": "For joint project with Toerism Flanders, 'Pin your point' was created. Over 160 contributors added a few thousand benches and picnictables and spotted 100 charging station for bicycles.",
|
||||
"toerisme_vlaanderen": "For joint project with Visit Flanders, 'Pin your point' was created. Over 160 contributors added a few thousand benches and picnictables and spotted 100 charging station for bicycles.",
|
||||
"whatIsOsm": "What is OpenStreetMap?"
|
||||
},
|
||||
"general": {
|
||||
|
|
13
test.ts
13
test.ts
|
@ -6,6 +6,11 @@ import {Utils} from "./Utils";
|
|||
import {SvgToPdf, SvgToPdfOptions} from "./Utils/svgToPdf";
|
||||
import {AllKnownLayouts} from "./Customizations/AllKnownLayouts";
|
||||
import Locale from "./UI/i18n/Locale";
|
||||
import LayerConfig from "./Models/ThemeConfig/LayerConfig";
|
||||
import {And} from "./Logic/Tags/And";
|
||||
import {Tag} from "./Logic/Tags/Tag";
|
||||
import {Overpass} from "./Logic/Osm/Overpass";
|
||||
import Constants from "./Models/Constants";
|
||||
|
||||
let i = 0
|
||||
|
||||
|
@ -17,6 +22,14 @@ function createElement(): string {
|
|||
}
|
||||
|
||||
async function main() {
|
||||
{
|
||||
// Dirty hack!
|
||||
// Make the charging-station layer simpler to allow querying it by overpass
|
||||
const chargingStationLayer: LayerConfig = AllKnownLayouts.allKnownLayouts.get("toerisme_vlaanderen").layers.find(l => l.id === "charging_station_ebikes")
|
||||
// chargingStationLayer.source.osmTags = new And([new Tag("amenity","charging_station"), new Tag("bicycle","yes")])
|
||||
Constants.defaultOverpassUrls.splice(0,1) // remove overpass-api.de for this run
|
||||
}
|
||||
|
||||
|
||||
const svg = await Utils.download(window.location.protocol + "//" + window.location.host + "/assets/templates/MapComplete-flyer.svg")
|
||||
const svgBack = await Utils.download(window.location.protocol + "//" + window.location.host + "/assets/templates/MapComplete-flyer.back.svg")
|
||||
|
|
Loading…
Reference in a new issue