Skip to content

Commit

Permalink
add SOI basemap to the list of base layers
Browse files Browse the repository at this point in the history
  • Loading branch information
ramSeraph committed Oct 9, 2024
1 parent 725446f commit eacf13c
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions static/view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

const currUrl = window.location.href;


const srcName = 'source-to-view';

let protocol = new pmtiles.Protocol();
Expand All @@ -26,6 +28,30 @@ var lightColors = [
'00FFFF' // turquoise
];

const soiTileUrl = decodeURI(new URL('/soi/osm/{z}/{x}/{y}.webp', currUrl).href);
console.log(soiTileUrl);
// TODO: pick different colors for layers for SOI basemap to make things more visible
var SOI_OSM_Imagery = {
'name': 'SOI OSM Imagery',
'initial': false,
'sources': {
'soi-osm-imagery': {
'type': 'raster',
'tiles': [ soiTileUrl ],
'attribution': 'Tiles &copy; Survey of India &mdash; Source: <a href="https://onlinemaps.surveyofindia.gov.in/">1:50000 Open Series Maps</a>',
'layers': [
{
'id': 'soi-osm-layer',
'type': 'raster',
'minZoom': 0,
'maxZoom': 14,
}
],
'maxZoom': 14,
}
}
};

var Esri_WorldImagery = {
'name': 'ESRI World Imagery',
'initial': false,
Expand All @@ -41,7 +67,8 @@ var Esri_WorldImagery = {
'minZoom': 0,
'maxZoom': 17,
}
]
],
'maxZoom': 17,
}
}
};
Expand All @@ -66,7 +93,8 @@ var Carto_Dark = {
'minZoom': 0,
'maxZoom': 20,
}
]
],
'maxZoom': 20,
},
'india-boundary-correcter': {
'type': 'vector',
Expand Down Expand Up @@ -115,11 +143,10 @@ var Carto_Dark = {
}
};


var baseLayers = [
//Stadia_AlidadeSmoothDark,
Carto_Dark,
Esri_WorldImagery
Esri_WorldImagery,
SOI_OSM_Imagery,
];

function randomColor(colors) {
Expand Down Expand Up @@ -491,8 +518,7 @@ function setTitle() {
document.title = data['title'];
})
.catch(error => {
// Handle any errors that occurred during the fetch
console.error('Fetch error:', error);
console.error('Title fetch error:', error);
});
}

Expand Down

0 comments on commit eacf13c

Please sign in to comment.