391 lines
11 KiB
JavaScript
391 lines
11 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const stylePath = path.join(__dirname, '../public/style.json');
|
|
const tacticalStylePath = path.join(__dirname, '../public/tactical-style.json');
|
|
|
|
const baseStyle = JSON.parse(fs.readFileSync(stylePath, 'utf8'));
|
|
|
|
// Clone the base style and add custom tactical vector sources
|
|
const tacticalStyle = {
|
|
...baseStyle,
|
|
name: "Intaleq Sovereign Tactical Military Style (منظومة الدفاع التكتيكية)",
|
|
metadata: {
|
|
...baseStyle.metadata,
|
|
version: "3.2.0-tactical",
|
|
description: "Sovereign Military Tactical Style with Hillshade, Rock Escarpments, Cliffs, Retaining Walls, Berms, Wadis, Quarries, and Man-Made Obstacles"
|
|
},
|
|
sources: {
|
|
...baseStyle.sources,
|
|
"tactical-obstacles": {
|
|
type: "vector",
|
|
tiles: ["https://tiles.intaleqapp.com/tactical_terrain_obstacles/{z}/{x}/{y}"],
|
|
maxzoom: 16
|
|
},
|
|
"overture_land_cover": {
|
|
type: "vector",
|
|
tiles: ["https://tiles.intaleqapp.com/overture_land_cover/{z}/{x}/{y}"],
|
|
maxzoom: 14
|
|
}
|
|
}
|
|
};
|
|
|
|
// Define Tactical Obstacle & Terrain Layers with explicit source-layer
|
|
const tacticalLayers = [
|
|
// ── 1. OVERTURE LAND COVER (الصخور الجرداء والموانع الطبيعية من خرائط أوفرتشر) ──
|
|
{
|
|
id: "tactical-overture-barren-rock",
|
|
type: "fill",
|
|
source: "overture_land_cover",
|
|
"source-layer": "overture_land_cover",
|
|
filter: ["any",
|
|
["in", "subtype", "barren", "rock", "sand"],
|
|
["in", "class", "barren", "rock", "bare_ground"]
|
|
],
|
|
paint: {
|
|
"fill-color": "#78716c",
|
|
"fill-opacity": 0.4
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-overture-barren-outline",
|
|
type: "line",
|
|
source: "overture_land_cover",
|
|
"source-layer": "overture_land_cover",
|
|
filter: ["any",
|
|
["in", "subtype", "barren", "rock", "sand"],
|
|
["in", "class", "barren", "rock", "bare_ground"]
|
|
],
|
|
paint: {
|
|
"line-color": "#57534e",
|
|
"line-width": 1.6,
|
|
"line-dasharray": [3, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-overture-wetland",
|
|
type: "fill",
|
|
source: "overture_land_cover",
|
|
"source-layer": "overture_land_cover",
|
|
filter: ["any",
|
|
["==", "subtype", "wetland"],
|
|
["==", "class", "wetland"]
|
|
],
|
|
paint: {
|
|
"fill-color": "#0d9488",
|
|
"fill-opacity": 0.35
|
|
}
|
|
},
|
|
|
|
// ── 2. NATURAL ROCK & TERRAIN POLYGONS (المقاطع والكتل الصخرية والمقالع) ──
|
|
{
|
|
id: "tactical-bare-rock-poly",
|
|
type: "fill",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["in", "natural", "bare_rock", "rock", "scree", "shingle", "bedrock"],
|
|
paint: {
|
|
"fill-color": "#78716c",
|
|
"fill-opacity": 0.45
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-bare-rock-outline",
|
|
type: "line",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["in", "natural", "bare_rock", "rock", "scree", "shingle", "bedrock"],
|
|
paint: {
|
|
"line-color": "#57534e",
|
|
"line-width": 1.8,
|
|
"line-dasharray": [3, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-quarry-poly",
|
|
type: "fill",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["any", ["==", "landuse", "quarry"], ["==", "man_made", "quarry"], ["==", "landuse", "surface_mining"]],
|
|
paint: {
|
|
"fill-color": "#d97706",
|
|
"fill-opacity": 0.35
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-quarry-outline",
|
|
type: "line",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["any", ["==", "landuse", "quarry"], ["==", "man_made", "quarry"], ["==", "landuse", "surface_mining"]],
|
|
paint: {
|
|
"line-color": "#b45309",
|
|
"line-width": 2.5,
|
|
"line-dasharray": [4, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-wetland-poly",
|
|
type: "fill",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["any", ["==", "natural", "wetland"], ["==", "wetland", "marsh"], ["==", "natural", "marsh"]],
|
|
paint: {
|
|
"fill-color": "#0d9488",
|
|
"fill-opacity": 0.35
|
|
}
|
|
},
|
|
|
|
// ── 3. HYDROLOGICAL DEFILES & WADIS (مجاري الأودية والسيول الجافة) ──
|
|
{
|
|
id: "tactical-wadis-lines",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["in", "waterway", "wadi", "dry_stream", "drain", "ditch"],
|
|
paint: {
|
|
"line-color": "#0891b2",
|
|
"line-width": 2.4,
|
|
"line-dasharray": [3, 2],
|
|
"line-opacity": 0.95
|
|
}
|
|
},
|
|
|
|
// ── 4. CLIFFS & ESCARPMENTS (الجروف الصخرية الشاهقة والنتوءات الحادة) ──
|
|
{
|
|
id: "tactical-cliffs-casing",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["==", "natural", "cliff"],
|
|
paint: {
|
|
"line-color": "#451a03",
|
|
"line-width": 5.0,
|
|
"line-opacity": 0.95
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-cliffs-inner",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["==", "natural", "cliff"],
|
|
paint: {
|
|
"line-color": "#dc2626",
|
|
"line-width": 2.5,
|
|
"line-dasharray": [2, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-ridges-lines",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["in", "natural", "ridge", "arete"],
|
|
paint: {
|
|
"line-color": "#92400e",
|
|
"line-width": 2.8,
|
|
"line-dasharray": [4, 2]
|
|
}
|
|
},
|
|
|
|
// ── 5. POSTGIS DEDICATED TACTICAL OBSTACLES TABLE (جدول الموانع التكتيكية المدمج) ──
|
|
{
|
|
id: "tactical-db-cliffs",
|
|
type: "line",
|
|
source: "tactical-obstacles",
|
|
"source-layer": "tactical_terrain_obstacles",
|
|
filter: ["==", "severity", "SEVERE_NO_GO"],
|
|
paint: {
|
|
"line-color": "#dc2626",
|
|
"line-width": 4.5,
|
|
"line-dasharray": [3, 1]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-db-retaining-walls",
|
|
type: "line",
|
|
source: "tactical-obstacles",
|
|
"source-layer": "tactical_terrain_obstacles",
|
|
filter: ["==", "severity", "RESTRICTED"],
|
|
paint: {
|
|
"line-color": "#e11d48",
|
|
"line-width": 3.2
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-db-barriers",
|
|
type: "line",
|
|
source: "tactical-obstacles",
|
|
"source-layer": "tactical_terrain_obstacles",
|
|
filter: ["==", "severity", "TACTICAL_BARRIER"],
|
|
paint: {
|
|
"line-color": "#f59e0b",
|
|
"line-width": 3.0,
|
|
"line-dasharray": [3, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-db-wadis",
|
|
type: "line",
|
|
source: "tactical-obstacles",
|
|
"source-layer": "tactical_terrain_obstacles",
|
|
filter: ["==", "severity", "DRAINAGE_DEFILE"],
|
|
paint: {
|
|
"line-color": "#0891b2",
|
|
"line-width": 2.6,
|
|
"line-dasharray": [3, 2]
|
|
}
|
|
},
|
|
|
|
// ── 6. MAN-MADE BARRIERS (الجدران الاستنادية، السواتر الترابية، الحواجز والأسوار) ──
|
|
{
|
|
id: "tactical-retaining-walls",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["==", "barrier", "retaining_wall"],
|
|
paint: {
|
|
"line-color": "#e11d48",
|
|
"line-width": 3.2,
|
|
"line-opacity": 1.0
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-berms-embankments",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["any", ["==", "barrier", "berm"], ["==", "man_made", "embankment"]],
|
|
paint: {
|
|
"line-color": "#f59e0b",
|
|
"line-width": 3.0,
|
|
"line-dasharray": [3, 1]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-trenches-ditches",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["==", "barrier", "ditch"],
|
|
paint: {
|
|
"line-color": "#881337",
|
|
"line-width": 2.5,
|
|
"line-dasharray": [2, 2]
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-fences-walls",
|
|
type: "line",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["in", "barrier", "wall", "jersey_barrier", "fence", "wire_fence"],
|
|
paint: {
|
|
"line-color": "#991b1b",
|
|
"line-width": 2.0,
|
|
"line-dasharray": [3, 2]
|
|
}
|
|
},
|
|
|
|
// ── 7. TACTICAL POINTS (فتحات المغاور والكهوف، الشلالات، والمكاشف الصخرية) ──
|
|
{
|
|
id: "tactical-cave-entrances",
|
|
type: "circle",
|
|
source: "local-osm-points",
|
|
"source-layer": "planet_osm_point",
|
|
filter: ["==", "natural", "cave_entrance"],
|
|
paint: {
|
|
"circle-radius": 6.0,
|
|
"circle-color": "#1e293b",
|
|
"circle-stroke-color": "#f59e0b",
|
|
"circle-stroke-width": 2.5
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-waterfalls",
|
|
type: "circle",
|
|
source: "local-osm-points",
|
|
"source-layer": "planet_osm_point",
|
|
filter: ["==", "waterway", "waterfall"],
|
|
paint: {
|
|
"circle-radius": 5.5,
|
|
"circle-color": "#06b6d4",
|
|
"circle-stroke-color": "#ffffff",
|
|
"circle-stroke-width": 2
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-outcrops",
|
|
type: "circle",
|
|
source: "local-osm-points",
|
|
"source-layer": "planet_osm_point",
|
|
filter: ["==", "geological", "outcrop"],
|
|
paint: {
|
|
"circle-radius": 5.0,
|
|
"circle-color": "#c2410c",
|
|
"circle-stroke-color": "#ffffff",
|
|
"circle-stroke-width": 1.5
|
|
}
|
|
},
|
|
|
|
// ── 8. TACTICAL LABELS (تسميات الموانع والمعالم التكتيكية الحاكمة) ──
|
|
{
|
|
id: "tactical-obstacle-text-lines",
|
|
type: "symbol",
|
|
source: "local-osm-lines",
|
|
"source-layer": "planet_osm_line",
|
|
filter: ["any",
|
|
["==", "natural", "cliff"],
|
|
["==", "barrier", "retaining_wall"],
|
|
["==", "waterway", "wadi"],
|
|
["in", "natural", "ridge", "arete"]
|
|
],
|
|
minzoom: 12,
|
|
layout: {
|
|
"symbol-placement": "line",
|
|
"text-field": "{name}",
|
|
"text-size": 11,
|
|
"text-font": ["Noto Sans Regular"],
|
|
"text-letter-spacing": 0.05
|
|
},
|
|
paint: {
|
|
"text-color": "#7f1d1d",
|
|
"text-halo-color": "#ffffff",
|
|
"text-halo-width": 2.0
|
|
}
|
|
},
|
|
{
|
|
id: "tactical-obstacle-text-poly",
|
|
type: "symbol",
|
|
source: "local-osm-polygons",
|
|
"source-layer": "planet_osm_polygon",
|
|
filter: ["any",
|
|
["==", "landuse", "quarry"],
|
|
["in", "natural", "bare_rock", "rock", "scree", "wetland"]
|
|
],
|
|
minzoom: 12,
|
|
layout: {
|
|
"text-field": "{name}",
|
|
"text-size": 11,
|
|
"text-font": ["Noto Sans Regular"]
|
|
},
|
|
paint: {
|
|
"text-color": "#78350f",
|
|
"text-halo-color": "#ffffff",
|
|
"text-halo-width": 2.0
|
|
}
|
|
}
|
|
];
|
|
|
|
// Insert the tactical layers before road labels and text symbols for optimal z-ordering
|
|
const textIndex = tacticalStyle.layers.findIndex((l) => l.id && (l.id.includes('label') || l.type === 'symbol'));
|
|
if (textIndex > -1) {
|
|
tacticalStyle.layers.splice(textIndex, 0, ...tacticalLayers);
|
|
} else {
|
|
tacticalStyle.layers.push(...tacticalLayers);
|
|
}
|
|
|
|
fs.writeFileSync(tacticalStylePath, JSON.stringify(tacticalStyle, null, 2), 'utf8');
|
|
console.log(`✅ Successfully generated tactical-style.json with ${tacticalLayers.length} tactical layers and Overture/PostGIS sources!`);
|