From b225c9e8ae04790ae0259ae7135529bf7e3d5edd Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Mon, 9 Jan 2023 17:32:21 +0100 Subject: [PATCH] label on top of lines --- .../map/layers/borough-boundary-layer.tsx | 19 +++++-------------- .../map/layers/borough-label-layer.tsx | 17 +++++++++++++++++ app/src/frontend/map/map.tsx | 7 +++++++ 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 app/src/frontend/map/layers/borough-label-layer.tsx diff --git a/app/src/frontend/map/layers/borough-boundary-layer.tsx b/app/src/frontend/map/layers/borough-boundary-layer.tsx index aaec43f6..752efc65 100644 --- a/app/src/frontend/map/layers/borough-boundary-layer.tsx +++ b/app/src/frontend/map/layers/borough-boundary-layer.tsx @@ -15,23 +15,14 @@ export function BoroughBoundaryLayer({}) { }, []); if(borough == "enabled") { - return boundaryGeojson && - <>; - } else if (borough == "disabled") { - return
- // do not display anything return boundaryGeojson && + attribution='Borough boundary from London Datastore Ordnance Survey Open Data - Contains public sector information licensed under the Open Government Licence v3.0' + data={boundaryGeojson} + style={{color: '#f00', fill: false, weight: 1}} + />; } else { - return boundaryGeojson && - ; + return <> } } diff --git a/app/src/frontend/map/layers/borough-label-layer.tsx b/app/src/frontend/map/layers/borough-label-layer.tsx new file mode 100644 index 00000000..34787602 --- /dev/null +++ b/app/src/frontend/map/layers/borough-label-layer.tsx @@ -0,0 +1,17 @@ +import { GeoJsonObject } from 'geojson'; +import React, { useEffect, useState } from 'react'; +import { GeoJSON } from 'react-leaflet'; +import { useDisplayPreferences } from '../../displayPreferences-context'; +import { apiGet } from '../../apiHelpers'; +import { BuildingBaseLayerAllZoom } from './building-base-layer-all-zoom'; + +export function BoroughLabelLayer({}) { + const { borough } = useDisplayPreferences(); + + if(borough == "enabled") { + return ; + } else { + return <> + } +} + diff --git a/app/src/frontend/map/map.tsx b/app/src/frontend/map/map.tsx index 80261c67..c35ea3dc 100644 --- a/app/src/frontend/map/map.tsx +++ b/app/src/frontend/map/map.tsx @@ -14,6 +14,7 @@ import { Building } from '../models/building'; import { CityBaseMapLayer } from './layers/city-base-map-layer'; import { CityBoundaryLayer } from './layers/city-boundary-layer'; import { BoroughBoundaryLayer } from './layers/borough-boundary-layer'; +import { BoroughLabelLayer } from './layers/borough-label-layer'; import { ParcelBoundaryLayer } from './layers/parcel-boundary-layer'; import { HistoricDataLayer } from './layers/historic-data-layer'; import { FloodBoundaryLayer } from './layers/flood-boundary-layer'; @@ -158,6 +159,12 @@ export const ColouringMap : FC = ({ /> } + + +