Extract all into file per layer, concatenate to single file

This commit is contained in:
Norbert Renner 2019-03-19 20:27:56 +01:00
parent 9c3682294e
commit 182edb2ee1
52 changed files with 10344 additions and 2200 deletions

View file

@ -0,0 +1,20 @@
{
"geometry": null,
"properties": {
"name": "OpenStreetMap.se",
"maxZoom": 18,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://openstreetmap.se/\" target=\"_blank\">OpenStreetMap Sweden</a>",
"id": "1010",
"subdomains": [
"a",
"b",
"c",
"d",
"e",
"f"
],
"url": "http://{s}.tile.openstreetmap.se/hydda/full/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,12 @@
{
"geometry": null,
"properties": {
"name": "4UMaps",
"maxZoom": 15,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://www.4umaps.eu/\">4UMaps</a>",
"id": "1016",
"url": "http://4umaps.eu/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,14 @@
{
"geometry": null,
"properties": {
"name": "Osmapa.pl",
"maxZoom": 20,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://osmapa.pl/\" target=\"_blank\">Osmapa.pl</a>",
"id": "1017",
"threed": "true",
"language": "pl",
"url": "http://{s}.tile.openstreetmap.pl/osmapa.pl/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,14 @@
{
"geometry": null,
"properties": {
"name": "Спутник",
"maxZoom": 19,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://maps.sputnik.ru/\" target=\"_blank\">Спутник</a>",
"id": "1021",
"threed": "true",
"language": "ru",
"url": "http://{s}.tiles.maps.sputnik.ru/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,19 @@
{
"geometry": null,
"properties": {
"name": "Космоснимки",
"maxZoom": 18,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://osm.kosmosnimki.ru/\" target=\"_blank\">ScanEx</a>",
"id": "1023",
"subdomains": [
"a",
"b",
"c",
"d"
],
"language": "ru",
"url": "http://{s}.tile.osm.kosmosnimki.ru/kosmo/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,12 @@
{
"geometry": null,
"properties": {
"name": "Thunderforest Outdoors",
"maxZoom": 22,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://www.thunderforest.com/\" target=\"_blank\">Andy Allan</a>",
"id": "1061",
"url": "http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,12 @@
{
"geometry": null,
"properties": {
"name": "Hike & Bike",
"maxZoom": 19,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://hikebikemap.de/\" target=\"_blank\">Colin Marquardt</a>",
"id": "1065",
"url": "http://toolserver.org/tiles/hikebike/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,13 @@
{
"geometry": null,
"properties": {
"name": "Refuges.info hiking",
"maxZoom": 18,
"attribution": "Map data: &copy; <a href=\"http://www.openstreetmap.org/copyright\" target=\"_blank\">OpenStreetMap</a> contributors, under ODbL | Tiles: &copy; <a href=\"http://maps.refuges.info/\" target=\"_blank\">sly</a>",
"id": "1069",
"old": "true",
"url": "http://maps.refuges.info/hiking/{z}/{x}/{y}.png",
"dataSource": "LayersCollection"
},
"type": "Feature"
}

View file

@ -0,0 +1,52 @@
const fs = require('fs');
const path = require('path');
const fetch = require('node-fetch');
const outDir = __dirname;
var includeList = [
"1016", // 4UMaps
"1065", // Hike & Bike Map
"1061", // Thunderforest Outdoors
"1021", // kosmosnimki.ru
"1017", // sputnik.ru
"1023", // Osmapa.pl - Mapa OpenStreetMap Polska
"1010", // OpenStreetMap.se (Hydda.Full)
"1069" // MRI (maps.refuges.info)
];
function extract(constantsJs) {
eval(constantsJs);
for (let i = 0; i < includeList.length; i++) {
let id = includeList[i];
let layer = getLayerDataByID(id);
if (!layer) {
console.warn('Layer not found: ' + id);
continue;
}
//console.log(`${layer.id}, ${layer.name}, ${layer.address}`);
layer.url = layer.address;
delete layer.address;
let geoJson = {
geometry: null,
properties: layer,
type: "Feature"
};
geoJson.properties.dataSource = 'LayersCollection';
const outFileName = path.join(outDir, layer.id + '.geojson');
const data = JSON.stringify(geoJson, null, 2);
fs.writeFileSync(outFileName, data);
}
}
// https://github.com/Edward17/LayersCollection/blob/gh-pages/constants.js
fetch('http://edward17.github.io/LayersCollection/constants.js')
.then(res => res.text())
.then(text => extract(text))
.catch(err => console.error(err));