diff --git a/app/javascript/projects/layer_palette.tsx b/app/javascript/projects/layer_palette.tsx index a7174028..c7abc0a5 100644 --- a/app/javascript/projects/layer_palette.tsx +++ b/app/javascript/projects/layer_palette.tsx @@ -87,18 +87,18 @@ export const LayerPalette = ({ addLayer, hide, dbModels, getTeamDatasets, teamNa ))} } -
+ {/*
-
+
*/}
{ Array<{ name: string, location: string, metric: string, loc : string | undefined, periodOptions: KewOption[], typeOptions: KewOption[] }>( @@ -413,8 +413,17 @@ export const LayerPalette = ({ addLayer, hide, dbModels, getTeamDatasets, teamNa
} { - dbModels.mapTileLayers.length > 0 &&
+ { dbModels.mapTileLayers.map(layer => ( +const getSourceWMS = memoize((layer: GeoserverLayer) => new TileWMS({ url: 'https://landscapes.wearepal.ai/geoserver/wms', - params: {'LAYERS': layer.layerName, 'TILED': true, 'STYLES': 'ml:treesandhedges'}, + params: {'LAYERS': layer.layerName, 'TILED': true}, serverType: 'geoserver', imageSmoothing: false }) ) - -export function reifyGeoserverWMSLayer (layer: MLLayer, existingLayer: BaseLayer | null) { +export function reifyGeoserverWMSLayer (layer: GeoserverLayer, existingLayer: BaseLayer | null) { return new TileLayer({ source: getSourceWMS(layer) diff --git a/app/javascript/projects/reify_layer/index.ts b/app/javascript/projects/reify_layer/index.ts index 4346606d..0fcf724b 100644 --- a/app/javascript/projects/reify_layer/index.ts +++ b/app/javascript/projects/reify_layer/index.ts @@ -33,7 +33,7 @@ export const reifyLayer = (layer: Layer, existingLayer: BaseLayer | null, dbMode case "AtiLayer" : return reifyAtiLayer(layer, existingLayer, map) case "ShapeLayer": return reifyShapeFileLayer(layer, existingLayer, map) case "BoundaryLayer": return reifyBoundaryLayer(layer, existingLayer, map) - case "MLLayer": return reifyGeoserverWMSLayer(layer, existingLayer) + case "GeoserverLayer": return reifyGeoserverWMSLayer(layer, existingLayer) case "KewLayer": return reifyKewLayer(layer, existingLayer, map) case "ORValLayer": return reifyOrvalLayer(layer, existingLayer, map) case "IMDLayer": return reifyIMDLayer(layer, existingLayer, map) diff --git a/app/javascript/projects/state.ts b/app/javascript/projects/state.ts index d41f68c2..52e20054 100644 --- a/app/javascript/projects/state.ts +++ b/app/javascript/projects/state.ts @@ -125,12 +125,14 @@ export interface DatasetLayer extends BaseLayer { deleted?: boolean } -export interface MLLayer extends BaseLayer { - type: "MLLayer" +export interface GeoserverLayer extends BaseLayer { + type: "GeoserverLayer" layerName: string + xOffset?: number + yOffset?: number } -export type Layer = OsmLayer | MapTileLayer | OverlayLayer | NevoLayer | CehLandCoverLayer | ModelOutputLayer | DatasetLayer | CropMapLayer | AtiLayer | ShapeLayer | BoundaryLayer | MLLayer | KewLayer | ORValLayer | IMDLayer +export type Layer = OsmLayer | MapTileLayer | OverlayLayer | NevoLayer | CehLandCoverLayer | ModelOutputLayer | DatasetLayer | CropMapLayer | AtiLayer | ShapeLayer | BoundaryLayer | GeoserverLayer | KewLayer | ORValLayer | IMDLayer export interface Project { name: string