aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/core/mapUtil.js
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/map/core/mapUtil.js')
-rw-r--r--modern/src/map/core/mapUtil.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/modern/src/map/core/mapUtil.js b/modern/src/map/core/mapUtil.js
index 2aa86c68..087c499b 100644
--- a/modern/src/map/core/mapUtil.js
+++ b/modern/src/map/core/mapUtil.js
@@ -67,23 +67,24 @@ export const reverseCoordinates = (it) => {
};
};
-export const geofenceToFeature = (item) => {
+export const geofenceToFeature = (theme, item) => {
+ let geometry;
if (item.area.indexOf('CIRCLE') > -1) {
const coordinates = item.area.replace(/CIRCLE|\(|\)|,/g, ' ').trim().split(/ +/);
const options = { steps: 32, units: 'meters' };
const polygon = circle([Number(coordinates[1]), Number(coordinates[0])], Number(coordinates[2]), options);
- return {
- id: item.id,
- type: 'Feature',
- geometry: polygon.geometry,
- properties: { name: item.name },
- };
+ geometry = polygon.geometry;
+ } else {
+ geometry = reverseCoordinates(parse(item.area));
}
return {
id: item.id,
type: 'Feature',
- geometry: reverseCoordinates(parse(item.area)),
- properties: { name: item.name },
+ geometry,
+ properties: {
+ name: item.name,
+ color: item.attributes.color || theme.palette.colors.geometry,
+ },
};
};