From 43ff7c49ba1c8cfeca148055765b16b10a4f0c44 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 25 Oct 2020 16:27:58 -0700 Subject: Show geofences layers --- modern/src/map/GeofenceMap.js | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) (limited to 'modern/src/map') diff --git a/modern/src/map/GeofenceMap.js b/modern/src/map/GeofenceMap.js index 965efaa..53d951d 100644 --- a/modern/src/map/GeofenceMap.js +++ b/modern/src/map/GeofenceMap.js @@ -26,18 +26,47 @@ const GeofenceMap = () => { } }); map.addLayer({ - 'id': id, + 'source': id, + 'id': 'geofences-fill', 'type': 'fill', + 'filter': [ + 'all', + ['==', '$type', 'Polygon'], + ], + 'paint': { + 'fill-color':'#3bb2d0', + 'fill-outline-color':'#3bb2d0', + 'fill-opacity':0.1, + }, + }); + map.addLayer({ 'source': id, - 'layout': {}, + 'id': 'geofences-line', + 'type': 'line', 'paint': { - 'fill-color': '#088', - 'fill-opacity': 0.8 - } + 'line-color': '#3bb2d0', + 'line-width': 2, + }, + }); + map.addLayer({ + 'source': id, + 'id': 'geofences-title', + 'type': 'symbol', + 'layout': { + 'text-field': '{name}', + 'text-font': ['Roboto Regular'], + 'text-size': 12, + }, + 'paint': { + 'text-halo-color': 'white', + 'text-halo-width': 1, + }, }); return () => { - map.removeLayer(id); + map.removeLayer('geofences-fill'); + map.removeLayer('geofences-line'); + map.removeLayer('geofences-title'); map.removeSource(id); }; }, []); -- cgit v1.2.3