@gridpin/node-red-gridpin 0.1.0
Offline geocoding in Node-RED: a node that asks a local GridPin server (gridpin serve), no API key, no cloud
@gridpin/node-red-gridpin
Offline geocoding in Node-RED. The node needs a GridPin server of your own (gridpin serve, or its Docker image):
addresses stay on your machines, there is no API key and no cloud service. One file covers one country; 13 countries
are available.
Install
From the editor: Menu → Manage palette → Install, search for gridpin. Or from the folder of your Node-RED
(~/.node-red):
npm install @gridpin/node-red-gridpin
Start the server
With the GridPin program:
gridpin serve "$(gridpin sheets fetch fr)" # listening on http://127.0.0.1:8080
Or with Docker (the tag is the country: au br ca de es fr it mx nl nz pl rs us; the image is linux/amd64):
docker run --rm -p 127.0.0.1:8080:8080 ghcr.io/gridpin/gridpin:fr
Node-RED in a container does not see the 127.0.0.1 of the host. Put both containers on one Docker network and set
Server of the node to the name of the container:
services:
node-red:
image: nodered/node-red
ports: ["1880:1880"]
gridpin:
image: ghcr.io/gridpin/gridpin:fr # Server: http://gridpin:8080
The node
msg.payload in |
msg.payload out |
|---|---|
| an address (string) | up to Answers hits: lat, lon, precision, street, housenumber, commune, postcode, confidence, weak |
| an array of addresses | one array of hits per address, in order, in one request |
{lat, lon} |
the nearest addresses of the point |
An empty array means no answer. msg.gridpin counts the addresses asked, the weak answers (check them before use)
and the empty ones. Addresses travel only in the body of a POST, never in a URL. A stopped server or an error answer
goes to the Catch node with a plain message (GridPin server not running at http://127.0.0.1:8080).
Example
Menu → Import → Examples → @gridpin/node-red-gridpin → geocode: one address, a list of addresses and a point through the node, with a Catch node for a stopped server. The addresses are French; change them for your country file.
Checked with
Node-RED 3.1.15, 4.1.18 and 5.0.10. The source and the tests are in gridpin/gridpin. GridPin maintains this node; its text and code were prepared with an AI assistant.