diff --git a/index.html b/index.html index 54680e3..087337f 100644 --- a/index.html +++ b/index.html @@ -50,9 +50,7 @@

ariaLabelOlFixedOverlay="Interactive example map" zoom="20" maxZoom="23" - basemap="MapboxSatellite" drawMode - drawMany drawType="Polygon" osCopyright="© Crown copyright and database rights 2024 OS (0)100024857" osProxyEndpoint="https://api.editor.planx.dev/proxy/ordnance-survey" diff --git a/package.json b/package.json index 63dd593..6834fe4 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "govuk-frontend": "^5.4.0", "jspdf": "^2.5.1", "lit": "^3.0.1", - "ol": "^9.1.0", + "ol": "^9.2.4", "ol-ext": "^4.0.21", - "ol-mapbox-style": "^12.3.0", + "ol-mapbox-style": "^12.3.4", "postcode": "^5.1.0", "proj4": "^2.11.0", "rambda": "^9.2.1" @@ -45,7 +45,7 @@ "@testing-library/user-event": "^14.5.2", "@types/file-saver": "^2.0.7", "@types/node": "22.0.3", - "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.3.0", + "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.4.0", "@types/proj4": "^2.5.5", "@vitest/ui": "^0.34.7", "happy-dom": "^9.1.9", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 681476d..82f9051 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -27,14 +27,14 @@ dependencies: specifier: ^3.0.1 version: 3.0.1 ol: - specifier: ^9.1.0 - version: 9.1.0 + specifier: ^9.2.4 + version: 9.2.4 ol-ext: specifier: ^4.0.21 - version: 4.0.21(ol@9.1.0) + version: 4.0.21(ol@9.2.4) ol-mapbox-style: - specifier: ^12.3.0 - version: 12.3.0(ol@9.1.0) + specifier: ^12.3.4 + version: 12.3.4(ol@9.2.4) postcode: specifier: ^5.1.0 version: 5.1.0 @@ -62,8 +62,8 @@ devDependencies: specifier: 22.0.3 version: 22.0.3 '@types/ol-ext': - specifier: npm:@siedlerchr/types-ol-ext@^3.3.0 - version: /@siedlerchr/types-ol-ext@3.3.0(jspdf@2.5.1) + specifier: npm:@siedlerchr/types-ol-ext@^3.4.0 + version: /@siedlerchr/types-ol-ext@3.4.0(jspdf@2.5.1) '@types/proj4': specifier: ^2.5.5 version: 2.5.5 @@ -1593,7 +1593,7 @@ packages: '@glorious/fyzer': 0.1.10 '@glorious/rasket': 0.1.3 '@uirouter/angularjs': 1.1.0(@uirouter/core@6.1.0)(angular@1.8.3) - axios: 1.7.5 + axios: 1.7.2 babel-loader: 8.3.0(@babel/core@7.24.7)(webpack@5.92.1) brace: 0.11.1 chokidar: 3.6.0 @@ -1913,8 +1913,8 @@ packages: dev: true optional: true - /@siedlerchr/types-ol-ext@3.3.0(jspdf@2.5.1): - resolution: {integrity: sha512-DPiiOP6sFbrE38HoLkPE9XxOq7CduQo/qWfDCCMLqzyEENGwimuC6RvDqP3zvC4lM6WNTYskYmoj2e7CVf0nKw==} + /@siedlerchr/types-ol-ext@3.4.0(jspdf@2.5.1): + resolution: {integrity: sha512-LtS9YNitiQ2UZV+RHVOS0Pehlkpcsp6qX9Sa2I33l4ZNqFCRB0T8YefGj0Se4SP8cPr1jc9+q1UU86BjFpg8ww==} peerDependencies: jspdf: ^2.5.1 dependencies: @@ -2646,8 +2646,8 @@ packages: possible-typed-array-names: 1.0.0 dev: false - /axios@1.7.5: - resolution: {integrity: sha512-fZu86yCo+svH3uqJ/yTdQ0QHpQu5oL+/QE+QPSv6BZSkDAoky9vytxp7u5qk83OJFS3kEBcesWni9WTZAv3tSw==} + /axios@1.7.2: + resolution: {integrity: sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==} dependencies: follow-redirects: 1.15.6 form-data: 4.0.0 @@ -3728,7 +3728,7 @@ packages: dev: false /ee-first@1.1.1: - resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + resolution: {integrity: sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=} dev: true /electron-to-chromium@1.4.812: @@ -4213,7 +4213,7 @@ packages: dev: true /fresh@0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + resolution: {integrity: sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=} engines: {node: '>= 0.6'} dev: true @@ -5697,26 +5697,26 @@ packages: resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} dev: true - /ol-ext@4.0.21(ol@9.1.0): + /ol-ext@4.0.21(ol@9.2.4): resolution: {integrity: sha512-xP4oVD5KBvJW6P9UQwmPcgqMDh6nzUrHjle4qhNqzRW7OkP02mObw5UMGAgz+uhIW8doJ3hYCwy2HcpU1JFpig==} peerDependencies: ol: '>= 5.3.0' dependencies: - ol: 9.1.0 + ol: 9.2.4 dev: false - /ol-mapbox-style@12.3.0(ol@9.1.0): - resolution: {integrity: sha512-DPGWcEeC/XNejo0N10DpVOkMr2pRSzxOYWpe9RoOPiC9Ph34jiuyRpFQsLzlnJPrRo7pdQOYSYoM+mL8QF/HBA==} + /ol-mapbox-style@12.3.4(ol@9.2.4): + resolution: {integrity: sha512-TxGJZw4hmvc6n5dHSyAE8ZpgALJ6hVG5Q9yl0j2Q1KmLS9iq4wMpb383TAitWiG86SvJV4oDkWMGkyyMLfVyew==} peerDependencies: ol: '*' dependencies: '@mapbox/mapbox-gl-style-spec': 13.28.0 mapbox-to-css-font: 2.4.4 - ol: 9.1.0 + ol: 9.2.4 dev: false - /ol@9.1.0: - resolution: {integrity: sha512-nDrkJ2tzZNpo/wzN/PpHV5zdxbnXZaFktoMaD2cFLEc6gCwlgLY21Yd8wnt/4FjaVYwLBnbN9USXSwIBGcyksQ==} + /ol@9.2.4: + resolution: {integrity: sha512-bsbu4ObaAlbELMIZWnYEvX4Z9jO+OyCBshtODhDKmqYTPEfnKOX3RieCr97tpJkqWTZvyV4tS9UQDvHoCdxS+A==} dependencies: color-rgba: 3.0.0 color-space: 2.0.1 diff --git a/src/components/my-map/snapping.ts b/src/components/my-map/snapping.ts index 827e6d6..efde8fe 100644 --- a/src/components/my-map/snapping.ts +++ b/src/components/my-map/snapping.ts @@ -1,13 +1,14 @@ import { Feature } from "ol"; +import { FeatureLike } from "ol/Feature"; +import { Geometry } from "ol/geom"; import Point from "ol/geom/Point"; import { Vector as VectorLayer } from "ol/layer"; -import VectorTileLayer from "ol/layer/VectorTile"; import VectorSource from "ol/source/Vector"; import { Fill, Style } from "ol/style"; import CircleStyle from "ol/style/Circle"; import { splitEvery } from "rambda"; -export const pointsSource = new VectorSource({ +export const pointsSource: VectorSource> = new VectorSource({ features: [], wrapX: false, }); @@ -28,13 +29,13 @@ export const pointsLayer = new VectorLayer({ }); /** - * Extract points that are available to snap to when a VectorTileLayer basemap is displayed - * @param basemap - a VectorTileLayer + * Extract points that are available to snap to when an OS VectorLayer basemap is displayed + * @param basemap - a VectorLayer * @param extent - an array of 4 points * @returns - a VectorSource populated with points within the extent */ export function getSnapPointsFromVectorTiles( - basemap: VectorTileLayer, + basemap: VectorLayer, extent: number[], ) { const points = @@ -42,7 +43,9 @@ export function getSnapPointsFromVectorTiles( basemap .getSource() ?.getFeaturesInExtent(extent) - ?.filter((feature) => feature.getGeometry()?.getType() !== "Point") + ?.filter( + (feature: FeatureLike) => feature.getGeometry()?.getType() !== "Point", + ) ?.flatMap((feature: any) => feature.flatCoordinates_); if (points) {