Skip to content

Commit

Permalink
feat: Use the tile layer variant from the settings for every map
Browse files Browse the repository at this point in the history
  • Loading branch information
iandebruin98 committed Nov 7, 2024
1 parent 59b4625 commit 431ba8d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/leaflet-map/src/base-map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ const BaseMap = ({
center.lat && center.lng
? { lat: center.lat, lng: center.lng }
: { lat: 52.37104644463586, lng: 4.900402911007405 };

tilesVariant = props?.map?.tilesVariant || tilesVariant ||'nlmaps';
const customUrlSetting = tilesVariant === 'custom' ? props?.map?.customUrl : undefined;


// clustering geeft errors; ik begrijp niet waarom: het gebeurd alleen in de gebuilde widgets, niet in de dev componenten
Expand Down Expand Up @@ -375,6 +378,7 @@ const BaseMap = ({
// ToDo: waarom kan ik die niet gewoon als props meesturen
const tileLayerProps = {
tilesVariant,
customUrlSetting,
tiles,
minZoom,
maxZoom,
Expand Down
3 changes: 2 additions & 1 deletion packages/leaflet-map/src/tile-layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default function TileLayer({
tiles = null,
minZoom = 0,
maxZoom = 25,
customUrl = '',
...props
}: MapTilesProps) {

Expand Down Expand Up @@ -52,7 +53,7 @@ export default function TileLayer({
maxZoom={ typeof maxZoom != 'undefined' ? maxZoom : 19 }
minZoom={ typeof minZoom != 'undefined' ? minZoom : 0 }
subdomains={tiles && tiles.subdomains || ''}
url={tiles && tiles.url || 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/standaard/EPSG:3857/{z}/{x}/{y}.png'}
url={customUrl || 'https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/standaard/EPSG:3857/{z}/{x}/{y}.png'}
/>)

default:
Expand Down
1 change: 1 addition & 0 deletions packages/leaflet-map/src/types/map-tiles-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type MapTiles = {

export type MapTilesProps = {
tilesVariant?: string,
customUrl?: string,
tiles?: MapTiles | null,
minZoom?: number,
maxZoom?: number,
Expand Down
2 changes: 2 additions & 0 deletions packages/types/project-setting-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@ export type ProjectSettingProps = {
minZoom: string;
maxZoom: string;
areaId: string;
tilesVariant?: string;
customUrl?: string;
};
};

0 comments on commit 431ba8d

Please sign in to comment.