import axios from 'axios'; let workspace_name = "geohr"; let datastore_name = "geohr"; let mapId = window.localStorage.getItem('map_id'); export let appConfig = { geoserver_host: "https://osmap.id/geoserver/", // online workspace_name: workspace_name, datastore_name: datastore_name, geoserver_username: "admin", geoserver_password: "geoserver" } export let MAP_ID = mapId; /*export const appConfig = { geoserver_host: "http://192.168.99.110/geoserver/", // local ip ardhi workspace_name: "bmd_denpasar", datastore_name: "bmd_denpasar_imports", geoserver_username: "admin", geoserver_password: "geoserver" }*/ export const BMD_DENPASAR_MAPSERVICE_URL = "http://siopas.co.id/bmd-denpasar/public/maps/mbtiles-mapservices-epsg3857.php"; export const IU_MAPSERVICE_URL = "http://202.47.70.196/map-service/mbtiles-mapservices-epsg3857.php"; export const WMS_CAPABILITIES_URL = appConfig.geoserver_host+appConfig.workspace_name+'/ows/service?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities'; export const WMS_CAPABILITIES_URL_2 = appConfig.geoserver_host+'/wms?service?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities'; export const nominatimBaseUrl = "https://address.oslog.id/search?"; export const wfsDispatcherUrl = appConfig.geoserver_host+"wfs/WfsDispatcher"; export const layerStyleUrl = appConfig.geoserver_host+"wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetStyles&LAYERS="+appConfig.workspace_name+":"; export const legendPicUrl = appConfig.geoserver_host+"wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER="+appConfig.workspace_name+":"; export const layerThumbnailUrl = (layerName) => { const width = "280"; const height = "150"; const format = "image/png8"; let imageUrl = appConfig.geoserver_host+"wms/reflect?layers="+appConfig.workspace_name+":"+layerName+"&width="+width+"&height="+height+"&format="+format+""; return imageUrl; } export const setRequestMapHeader = () => { axios.interceptors.request.use(function (config) { config.headers["Authorization"] = "Basic " + btoa(appConfig.geoserver_username + ":" + appConfig.geoserver_password) return config; }, function (error) { return Promise.reject(error); }); }