diff options
Diffstat (limited to 'modern/src/map/GeofenceMap.js')
-rw-r--r-- | modern/src/map/GeofenceMap.js | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js index 53d951d2..c98a8c16 100644 --- a/modern/src/map/GeofenceMap.js +++ b/modern/src/map/GeofenceMap.js @@ -1,9 +1,8 @@ -import wellknown from 'wellknown'; import { useEffect, useState } from 'react'; import { map } from './Map'; import { useEffectAsync } from '../reactHelper'; -import { reverseCoordinates } from './mapUtil'; +import { geofenceToFeature } from './mapUtil'; const GeofenceMap = () => { const id = 'geofences'; @@ -74,11 +73,7 @@ const GeofenceMap = () => { useEffect(() => { map.getSource(id).setData({ type: 'FeatureCollection', - features: geofences.map(item => [item.name, reverseCoordinates(wellknown(item.area))]).filter(([, geometry]) => !!geometry).map(([name, geometry]) => ({ - type: 'Feature', - geometry: geometry, - properties: { name }, - })), + features: geofences.map(geofenceToFeature) }); }, [geofences]); |