Skip to content

Commit

Permalink
Merge pull request #423 from wearepal/aerial-img
Browse files Browse the repository at this point in the history
Aerial photography 25cm on map view
  • Loading branch information
paulthatjazz authored Sep 10, 2024
2 parents e6d0f82 + 4872c11 commit d3af40b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
17 changes: 13 additions & 4 deletions app/javascript/projects/layer_palette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,18 @@ export const LayerPalette = ({ addLayer, hide, dbModels, getTeamDatasets, teamNa
))}
</Section>
}
<Section title="Machine Learning Output">
{/* <Section title="Machine Learning Output">
<AddLayerButton
addLayer={addLayer}
prototype={{
type: "MLLayer",
type: "GeoserverLayer",
layerName: "ml:tree_hedge_predictions",
name: "Trees & Hedges Classification",
visible: true,
opacity: 1,
}}
/>
</Section>
</Section> */}
<Section title="Kew Samples">
{
Array<{ name: string, location: string, metric: string, loc : string | undefined, periodOptions: KewOption[], typeOptions: KewOption[] }>(
Expand Down Expand Up @@ -413,8 +413,17 @@ export const LayerPalette = ({ addLayer, hide, dbModels, getTeamDatasets, teamNa
</Section>
}
{
dbModels.mapTileLayers.length > 0 &&
<Section title="Aerial/Satellite imagery">
<AddLayerButton
addLayer={addLayer}
prototype={{
layerName: "rgb:full_mosaic_3857",
type: "GeoserverLayer",
name: "RGB 25cm",
visible: true,
opacity: 1,
}}
/>
{
dbModels.mapTileLayers.map(layer => (
<AddLayerButton
Expand Down
9 changes: 4 additions & 5 deletions app/javascript/projects/reify_layer/geoserver.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import BaseLayer from "ol/layer/Base"
import { MLLayer } from "../state"
import { GeoserverLayer } from "../state"
import TileLayer from "ol/layer/Tile"
import TileWMS from "ol/source/TileWMS"
import { memoize } from "lodash"



const getSourceWMS = memoize((layer: MLLayer) =>
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)
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/projects/reify_layer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions app/javascript/projects/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d3af40b

Please sign in to comment.