Skip to content

Commit

Permalink
Configure map layers and add scale line (#95)
Browse files Browse the repository at this point in the history
* muokattu layerit
* lisätty mittakaava
  • Loading branch information
sampov2 authored Jan 22, 2025
1 parent 19ec4d4 commit 6692b64
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
5 changes: 5 additions & 0 deletions src/components/map/MapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Map from 'ol/Map.js'
import View from 'ol/View.js'
import { OSM } from 'ol/source.js'
import { Tile as TileLayer } from 'ol/layer.js'
import { ScaleLine, defaults as defaultControls } from 'ol/control.js';

import MapContext from "./MapContext"

Expand Down Expand Up @@ -36,10 +37,14 @@ export const MapComponent: React.FC<MapComponentProps> = ({ view, onClickFeature
useEffect(() => {
if (!mapRef.current) return


const scaleControl = new ScaleLine({ units: 'metric' });

const mapObject: Map = new Map({
view: new View({
projection: config.projection
}),
controls: defaultControls().extend([scaleControl]),
layers: [new TileLayer({
source: new OSM()
})]
Expand Down
48 changes: 33 additions & 15 deletions src/config/layers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,9 @@ export const availableLayers: Array<LayerConfiguration> = [
type: 'WMS',
dimensions: ['time']
},
{
id: 'a530150a-0e40-4fdc-8087-d50b62404d8a',
title: 'Seabed_substrate_250k',
capabilitiesUrl: 'https://gtkdata.gtk.fi/arcgis/services/EMODnet/EMODnet_Geology/MapServer/WmsServer?SERVICE=WMS&REQUEST=GetCapabilities',
layer: 'Seabed_substrate_250k',
isDatalayer: true,
type: 'WMS',
legend: {
url: 'https://gtkdata.gtk.fi/arcgis/services/EMODnet/EMODnet_Geology/MapServer/WmsServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=Seabed_substrate_1M',
width: 210,
height: 126,
scale: 0.9
}
},
{
id: '245305de-0385-4c3b-9447-ebe8ab100ee1',
title: 'Syvyysmalli / Velmu',
title: 'Batymetria (Velmu)',
capabilitiesUrl: 'https://paikkatieto.ymparisto.fi/arcgis/services/Velmukartta/Velmukartta/MapServer/WmsServer?SERVICE=WMS&REQUEST=GetCapabilities',
layer: '1',
isDatalayer: true,
Expand All @@ -37,5 +23,37 @@ export const availableLayers: Array<LayerConfiguration> = [
height: 468,
scale: 0.8
}
},
{
id: 'a8f3a561-e01c-49c3-8065-81c2dd22c6b2',
title: 'Kuntarajat',
capabilitiesUrl: 'https://geo.stat.fi/geoserver/tilastointialueet/wms?SERVICE=WMS&REQUEST=GetCapabilities',
layer: 'kunta1000k',
isDatalayer: false,
type: 'WMS'
},
{
id: '022ae14d-53c6-4af2-9de8-7952c27123d2',
title: 'Puolustusvoimien suoja-alueet',
capabilitiesUrl: 'https://paikkatieto.ymparisto.fi/arcgis/services/Velmukartta/Velmukartta/MapServer/WmsServer?SERVICE=WMS&REQUEST=GetCapabilities',
layer: '125',
isDatalayer: false,
type: 'WMS'
},
{
id: 'e6e6477c-05b0-4880-af84-cc0f79ba55b0',
title: 'Suomen aluevesiraja',
capabilitiesUrl: 'https://julkinen.traficom.fi/inspirepalvelu/avoin/wms?request=getcapabilities',
layer: 'TerritorialSeaArea_L',
isDatalayer: false,
type: 'WMS'
},
{
id: '4131bf07-e6a6-4411-afdd-bd000067b4d0',
title: 'Kalankasvatusalueet',
capabilitiesUrl: 'https://paikkatiedot.ymparisto.fi/geoserver/velmukartta/wms?&service=WMS&VERSION=1.3.0&REQUEST=GetCapabilities',
layer: 'Kalankasvattamo',
isDatalayer: false,
type: 'WMS'
}
]

0 comments on commit 6692b64

Please sign in to comment.