hmpps-open-layers-map
Version:
A native Web Component for displaying maps using OpenLayers or MapLibre.
2 lines (1 loc) • 1.5 kB
JavaScript
;const t=require("ol/proj");var e=typeof document!="undefined"?document.currentScript:null;const s={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_OS_MAPS_API_KEY:"R4MAOLVcahZRGTJP99XjAeMDGVGPMynI",VITE_OS_MAPS_API_SECRET:"1JLvRZ8hHyV4859n",VITE_OS_MAPS_AUTH_URL:"https://api.os.uk/oauth2/token/v1",VITE_OS_MAPS_RASTER_URL:"https://api.os.uk/maps/raster/v1/zxy/Road_3857/{z}/{x}/{y}",VITE_OS_MAPS_VECTOR_BASE_URL:"https://api.os.uk/maps/vector/v1"},c=[-9.01,49.75,2.01,61.01],_=[-2.547855,54.00366],a=()=>typeof{url:typeof document=="undefined"?require("url").pathToFileURL(__filename).href:e&&e.tagName.toUpperCase()==="SCRIPT"&&e.src||new URL("config-DLNi6l9X.js",document.baseURI).href}!="undefined"&&"env"in{url:typeof document=="undefined"?require("url").pathToFileURL(__filename).href:e&&e.tagName.toUpperCase()==="SCRIPT"&&e.src||new URL("config-DLNi6l9X.js",document.baseURI).href}?s:typeof process!="undefined"&&process.env?process.env:{},r=a(),u=r.VITE_OS_MAPS_VECTOR_BASE_URL||"https://api.os.uk/maps/vector/v1",i=r.VITE_OS_MAPS_AUTH_URL||"https://api.os.uk/oauth2/token/v1",o=`${u.replace(/\/$/,"")}/vts`,n="/os-map/vector",p={view:{zoom:{min:5,max:20},default:{zoom:6,extent:t.transformExtent(c,"EPSG:4326","EPSG:3857"),centre:t.fromLonLat(_)}},tiles:{srs:"3857",zoom:{min:7,max:20},urls:{authUrl:i,localBasePath:n,localVectorStyleUrl:`${n}/style`,vectorStyleUrl:`${o}/resources/styles?srs=3857`,vectorSourceUrl:o},cacheExpirySeconds:604800}};exports.config=p;