1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00
node-red-nodes/parsers/geohash
2018-02-02 23:38:26 +00:00
..
70-geohash.html finish msg.property selector for geohash, msgpack and w3w 2018-02-02 23:38:26 +00:00
70-geohash.js update rest of parsers to allow property to be selected 2018-01-31 11:18:30 +00:00
LICENSE Update licenses and packages for all nodes 2016-11-06 20:26:19 +00:00
package.json finish msg.property selector for geohash, msgpack and w3w 2018-02-02 23:38:26 +00:00
README.md update parser and time nodes info style 2016-03-02 13:27:52 +00:00

node-red-node-geohash

A Node-RED node to encode and decode lat,lon pairs to a geohash string.

Install

Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-node-geohash

Usage

This function encodes a lat,lon string to and from a geohash.

If the msg.payload is a string it tries to see if it's a geohash - if so it tries to decode it and outputs a payload object containing

  • latitude
  • longitude
  • errorlatitude
  • error.longitude

If the msg.payload is an object with properties lat or latitude and lon or longitude - it will add a geohash property to the payload.

The precision can be set by msg.payload.precision from 1 to 9.

Example flow

[{"id":"60ebfc45.9f1404","type":"function","name":"","func":"msg.payload = {lat:51,lon:-1,precision:5};\nreturn msg;","outputs":1,"x":281,"y":485,"z":"385bdf8b.c7a42","wires":[["6f1c5357.90e3ac"]]},{"id":"6f1c5357.90e3ac","type":"geohash","name":"","x":415.5,"y":420,"z":"385bdf8b.c7a42","wires":[["71a94378.8e56bc"]]},{"id":"52763c46.ad89c4","type":"inject","name":"","topic":"","payload":"51.05,-1.05","payloadType":"string","repeat":"","crontab":"","once":false,"x":165.5,"y":337,"z":"385bdf8b.c7a42","wires":[["7b08247.f84f7dc"]]},{"id":"7b08247.f84f7dc","type":"geohash","name":"","x":360.5,"y":337,"z":"385bdf8b.c7a42","wires":[["6f1c5357.90e3ac","893e37b7.76c1c8"]]},{"id":"6fec77c4.901388","type":"inject","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":155,"y":397,"z":"385bdf8b.c7a42","wires":[["60ebfc45.9f1404"]]},{"id":"893e37b7.76c1c8","type":"debug","name":"","active":true,"console":"false","complete":"false","x":535,"y":337,"z":"385bdf8b.c7a42","wires":[]},{"id":"71a94378.8e56bc","type":"debug","name":"","active":true,"console":"false","complete":"false","x":590,"y":420,"z":"385bdf8b.c7a42","wires":[]}]