chore: add build artifacts, map assets, and routing data
This commit is contained in:
@@ -38,8 +38,12 @@ export class MapsController {
|
||||
@ApiOperation({ summary: 'Get MapLibre style JSON 🎨' })
|
||||
async getStyleJson(@Query('theme') theme: string, @Res() res: Response) {
|
||||
// Determine filenames based on theme
|
||||
const isDark = theme === 'obsidian';
|
||||
const filename = isDark ? 'style-dark.json' : 'style.json';
|
||||
let filename = 'style.json';
|
||||
if (theme === 'obsidian') {
|
||||
filename = 'style-dark.json';
|
||||
} else if (theme === 'satellite') {
|
||||
filename = 'style-satellite.json';
|
||||
}
|
||||
const fallbackFilename = 'style.json';
|
||||
|
||||
// Paths to check
|
||||
@@ -47,7 +51,7 @@ export class MapsController {
|
||||
path.join('/data', filename),
|
||||
path.join(process.cwd(), '../../', filename),
|
||||
path.join(process.cwd(), filename),
|
||||
// Fallbacks to light style if dark is missing
|
||||
// Fallbacks to light style if specific theme is missing
|
||||
path.join('/data', fallbackFilename),
|
||||
path.join(process.cwd(), '../../', fallbackFilename),
|
||||
path.join(process.cwd(), fallbackFilename),
|
||||
@@ -69,19 +73,53 @@ export class MapsController {
|
||||
const styleRaw = fs.readFileSync(stylePath, 'utf8');
|
||||
const styleObj = JSON.parse(styleRaw);
|
||||
|
||||
// Dynamic Theme support (Safety overrides or fine-tuning)
|
||||
// Dynamic Theme support
|
||||
if (theme === 'light') {
|
||||
styleObj.layers.forEach((layer: any) => {
|
||||
if (layer.id === 'background') {
|
||||
if (layer.id === 'background' && layer.paint) {
|
||||
layer.paint['background-color'] = '#FFFFFF';
|
||||
}
|
||||
});
|
||||
} else if (theme === 'obsidian') {
|
||||
// If we found style-dark.json, we don't strictly need this,
|
||||
// but keeping it as a helper or if it fell back to style.json
|
||||
styleObj.layers.forEach((layer: any) => {
|
||||
if (layer.id === 'background') {
|
||||
layer.paint['background-color'] = '#101014'; // Dark tone
|
||||
if (layer.id === 'background' && layer.paint) {
|
||||
layer.paint['background-color'] = '#101014';
|
||||
}
|
||||
});
|
||||
} else if (theme === 'satellite') {
|
||||
// Ensure ESRI Satellite layer is injected if not already present
|
||||
if (!styleObj.sources['esri-satellite']) {
|
||||
styleObj.sources['esri-satellite'] = {
|
||||
type: 'raster',
|
||||
tiles: [
|
||||
'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
|
||||
],
|
||||
tileSize: 256,
|
||||
maxzoom: 19,
|
||||
attribution: '© Esri, Maxar, Earthstar Geographics',
|
||||
};
|
||||
}
|
||||
if (!styleObj.layers.some((l: any) => l.id === 'esri-satellite-imagery')) {
|
||||
const satLayer = {
|
||||
id: 'esri-satellite-imagery',
|
||||
type: 'raster',
|
||||
source: 'esri-satellite',
|
||||
minzoom: 0,
|
||||
maxzoom: 19,
|
||||
paint: { 'raster-opacity': 1.0 },
|
||||
};
|
||||
const bgIdx = styleObj.layers.findIndex((l: any) => l.id === 'background');
|
||||
if (bgIdx >= 0) {
|
||||
styleObj.layers.splice(bgIdx + 1, 0, satLayer);
|
||||
} else {
|
||||
styleObj.layers.unshift(satLayer);
|
||||
}
|
||||
}
|
||||
styleObj.layers.forEach((l: any) => {
|
||||
if (l.id === 'background' && l.paint) {
|
||||
l.paint['background-color'] = '#000000';
|
||||
} else if ((l.id.includes('landuse') || l.id.includes('poly')) && l.type === 'fill' && l.paint) {
|
||||
l.paint['fill-opacity'] = 0.05;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -65,9 +65,11 @@ export class MapsService {
|
||||
console.warn('Geocoding internal error during routing:', e);
|
||||
}
|
||||
|
||||
const ghProfile = ['car', 'foot', 'bike'].includes(profile) ? profile : 'car';
|
||||
|
||||
const payload: any = {
|
||||
points: ghPoints,
|
||||
profile: profile,
|
||||
profile: ghProfile,
|
||||
locale: locale === 'en' ? 'ar' : locale, // Default to Arabic if not specified or fallback
|
||||
calc_points: true,
|
||||
points_encoded: false, // JSON arrays for reliable 3D elevation (SRTM)
|
||||
|
||||
Reference in New Issue
Block a user