Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow layers that have singleTile: true set to be used for gfi requests #241

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/plugins/Gfi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## unpublished

- Fix: Allow layers that have `singleTile` set to `true` and thus being an `ImageLayer` instead a `TileLayer` to be used for GFI-requests as well.

## 3.0.1

- Fix: Clean-up internal flag used for `multiSelect` if a drawing is aborted. This is always the case if a user simply clicks into the map holding CTRL / Command.
Expand Down
5 changes: 3 additions & 2 deletions packages/plugins/Gfi/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Map, Feature } from 'ol'
import BaseLayer from 'ol/layer/Base'
import ImageLayer from 'ol/layer/Image'
import TileLayer from 'ol/layer/Tile'
import { TileWMS } from 'ol/source'
import { ImageWMS, TileWMS } from 'ol/source'
import VectorSource from 'ol/source/Vector'
import { Feature as GeoJsonFeature, GeoJsonProperties } from 'geojson'
import {
Expand Down Expand Up @@ -31,7 +32,7 @@ export interface RequestGfiWmsParameters {
coordinate: [number, number]
layerConfiguration: RequestGfiParameters['layerConfiguration']
layerSpecification: RequestGfiParameters['layerSpecification']
layer: TileLayer<TileWMS>
layer: TileLayer<TileWMS> | ImageLayer<ImageWMS>
}

export type FeaturesByLayerId = Record<string, GeoJsonFeature[] | symbol>
Expand Down
7 changes: 4 additions & 3 deletions packages/plugins/Gfi/src/utils/requestGfi.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Feature as GeoJsonFeature } from 'geojson'
import { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'
import ImageLayer from 'ol/layer/Image'
import TileLayer from 'ol/layer/Tile'
import VectorLayer from 'ol/layer/Vector'
import { rawLayerList } from '@masterportal/masterportalapi'

import { RequestGfiParameters } from '../types'

import requestGfiWms from './requestGfiWms'
Expand Down Expand Up @@ -32,7 +33,7 @@ export function requestGfi({
layerConfiguration,
layerSpecification,
}
if (layer instanceof TileLayer) {
if (layer instanceof TileLayer || layer instanceof ImageLayer) {
return coordinateOrExtent.length === 2
? requestGfiWms({
...params,
Expand Down