diff --git a/src/shared/services/map-location/map-location.ts b/src/shared/services/map-location/map-location.ts index 2f73b50cd1..cb503da15d 100644 --- a/src/shared/services/map-location/map-location.ts +++ b/src/shared/services/map-location/map-location.ts @@ -8,12 +8,14 @@ import type { Incident } from 'types/api/incident' import type { Geometrie, Location } from 'types/incident' import type { RevGeo, Doc } from 'types/pdok/revgeo' +export type LatLng = [number, number] + const convertCoordsToLatLng = (coordinates: LatLngTuple) => { const coordsWithoutAltitude = [coordinates[0], coordinates[1]] return coordsWithoutAltitude .sort((a, b) => (a > b ? 1 : -1)) - .reverse() as LatLngTuple + .reverse() as LatLng } export const coordinatesToFeature = ({ diff --git a/src/signals/IncidentMap/types/incident-map.ts b/src/signals/IncidentMap/types/incident-map.ts index 631a1d110d..dc1ed6603b 100644 --- a/src/signals/IncidentMap/types/incident-map.ts +++ b/src/signals/IncidentMap/types/incident-map.ts @@ -1,8 +1,10 @@ import type { Feature } from 'geojson' +import type { LatLng } from 'shared/services/map-location/map-location' + export type PointLatLng = { type: 'Point' - coordinates: [number, number] + coordinates: LatLng } export type Properties = { diff --git a/src/signals/incident/components/form/MapSelectors/Asset/Selector/NearbyLayer/NearbyLayer.tsx b/src/signals/incident/components/form/MapSelectors/Asset/Selector/NearbyLayer/NearbyLayer.tsx index a4ec3c03dc..6f68a7cd97 100644 --- a/src/signals/incident/components/form/MapSelectors/Asset/Selector/NearbyLayer/NearbyLayer.tsx +++ b/src/signals/incident/components/form/MapSelectors/Asset/Selector/NearbyLayer/NearbyLayer.tsx @@ -16,6 +16,7 @@ import { useSelector } from 'react-redux' import { useFetch } from 'hooks' import configuration from 'shared/services/configuration/configuration' import { featureToCoordinates } from 'shared/services/map-location' +import type { LatLng } from 'shared/services/map-location/map-location' import reverseGeocoderService from 'shared/services/reverse-geocoder' import AssetSelectContext from 'signals/incident/components/form/MapSelectors/Asset/context' import { NEARBY_TYPE } from 'signals/incident/components/form/MapSelectors/constants' @@ -34,7 +35,7 @@ import WfsDataContext from '../WfsLayer/context' // Custom Point type, because the compiler complains about the coordinates type type Point = { type: 'Point' - coordinates: [number, number] + coordinates: LatLng } type Properties = {