node-red-contrib-geofence
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -66,3 +66,9 @@ /** | ||
RED.comms.publish(node.id + "/locationUpdate", loc); | ||
if(fence == null){ | ||
node.warn("No geofence defined"); | ||
return; | ||
} | ||
var points = []; | ||
@@ -69,0 +75,0 @@ var fenceCoordinates = fence.geometry.coordinates[0]; |
{ | ||
"name": "node-red-contrib-geofence", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "A simple node to filter based on location", | ||
@@ -5,0 +5,0 @@ "dependencies" :{ |
@@ -36,6 +36,10 @@ var configButton; | ||
var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; | ||
var osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors'; | ||
var osm = L.tileLayer(osmUrl, { maxZoom: 18, attribution: osmAttrib }); | ||
window.node_geofence_map = map; | ||
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | ||
maxZoom: 20, | ||
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors' | ||
L.tileLayer(osmUrl, { | ||
maxZoom: 18, | ||
attribution: osmAttrib | ||
}).addTo(map); | ||
@@ -65,2 +69,11 @@ | ||
L.control.layers( | ||
{ | ||
'osm': osm.addTo(map), | ||
"google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}', { | ||
attribution: 'google' | ||
}) | ||
}, { 'drawlayer': drawnItems }, { collapsed: true }).addTo(map); | ||
var editControl = new L.Control.Draw({ | ||
@@ -129,2 +142,13 @@ draw: false, | ||
var marker; | ||
RED.comms.subscribe(node.id + "/locationUpdate", function(topic, location) { | ||
var location = new L.LatLng(location.latitude, location.longitude) | ||
if(marker == null){ | ||
marker = L.marker(location); | ||
marker.addTo(map); | ||
} | ||
marker.setLatLng(location) | ||
}); | ||
Object.keys(nodeManager.geofences).map(function (nodeID, index) { | ||
@@ -131,0 +155,0 @@ var fence = L.GeoJSON.geometryToLayer(nodeManager.geofences[nodeID]); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4754696
44732