forked from bloigge/node-red-contrib-turf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathturf-node.html
executable file
·47 lines (44 loc) · 2.08 KB
/
turf-node.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script type="text/javascript">
RED.nodes.registerType('turf',{
category: 'location',
color: '#2ecc71',
defaults: {
name: {value:""}
},
inputs:1,
outputs:1,
icon: "turf.png",
label: function() {
return this.name||"turf";
}
});
</script>
<script type="text/x-red" data-template-name="turf">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/x-red" data-help-name="turf">
<p>A node which exposes all the awesome features of the <a target="_blank" href="http://turfjs.org/">Turf</a> Library for spatial analysis. <br> <h4>About Turf:</h4>
Turf includes traditional spatial operations, helper functions for creating GeoJSON data, and data classification and statistics tools. <br>
Turf uses GeoJSON for all geographic data. Turf expects the data to be standard WGS84 longitude, latitude coordinates. Check out <a target="_blank" href="geojson.io">geojson.io</a> for a tool to easily create this data. <br>
Most Turf functions work with GeoJSON features. These are are pieces of data that represent a collection of properties (ie: population, elevation, zipcode, etc.) along with a geometry. GeoJSON has several geometry types such as:
<ul>
<li>Point</li>
<li>LineString</li>
<li>Polygon</li>
</ul>
<br>
<h4>How to use the node:</h4>
The input messge must contain a <code>msg.topic</code> which sets the turf function (<a target="_blank" href ="http://turfjs.org/static/docs/">Turf Functions</a>).<br>
The <code>mgs.payload</code> must be an array of input parameters. <br>
<br>
Example: <br>
Input-msg for generating 100 random points within a given bounding box (<a target="_blank" href="http://turfjs.org/static/docs/module-turf_random.html">example from the docs</a>):
<pre>
msg.topic = "random";
msg.payload = ['points', 100, {bbox: [-70, 40, -60, 60]}];
</pre>
</p>
</script>