Skip to content
Snippets Groups Projects
Commit c25cf398 authored by Glenn Vorhes's avatar Glenn Vorhes
Browse files

add caching url generator

parent b8fe8932
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ import ol = require('custom-ol');
* @returns {string}
*/
export declare function makeServiceUrl(folder: string, service: string): string;
export declare function localCacheUrl(folder: string, service: string): string;
export interface LayerEsriMapServerOptions extends LayerBaseOptions {
addPopup?: boolean;
showLayers?: Array<number>;
......
......@@ -30,6 +30,20 @@ function makeServiceUrl(folder, service) {
return "https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/" + folder + "/" + service + "/MapServer";
}
exports.makeServiceUrl = makeServiceUrl;
function localCacheUrl(folder, service) {
var loc = window.location.href;
var url = "/mapserver/" + folder + "/" + service;
if (loc.indexOf('http://transportal.cee.wisc.edu') > -1) {
if (loc.toLowerCase().indexOf('webmapsstage') > -1) {
url = 'https://transportal.cee.wisc.edu/gis/webmapsstage' + url;
}
else {
url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url;
}
}
return url;
}
exports.localCacheUrl = localCacheUrl;
/**
* esri mapserver layer
* @augments LayerBase
......
This diff is collapsed.
......@@ -10,6 +10,8 @@ import $ = require('jquery');
const nm = provide('layers');
/**
* Helper to return the url to the service on the production server
* @param {string} folder
......@@ -20,6 +22,25 @@ export function makeServiceUrl(folder: string, service: string): string{
return `https://transportal.cee.wisc.edu/applications/arcgis2/rest/services/${folder}/${service}/MapServer`
}
export function localCacheUrl(folder: string, service: string): string{
let loc = window.location.href;
let url = `/mapserver/${folder}/${service}`;
if (loc.indexOf('http://transportal.cee.wisc.edu') > -1){
if (loc.toLowerCase().indexOf('webmapsstage') > -1){
url = 'https://transportal.cee.wisc.edu/gis/webmapsstage' + url;
} else {
url = 'https://transportal.cee.wisc.edu/gis/webmaps' + url
}
}
return url;
}
export interface LayerEsriMapServerOptions extends LayerBaseOptions {
addPopup?: boolean;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment