Node flow to convert ip to coordinates?

Thanks for your feedback!
I have tested the entire update process again, and it seems to be working fine here...
Version 1.0.0 is now available on npm:

image

@Jacq: there are now 3 different solutions for your problem, but you have not responded yet to any of those. Would be nice to get some feedback ....

1 Like

Wow, thanks for the overwhelming support.
To summarize the options for future visitors:

I have just tested three methods and they work great, thanks:

Here is the demo, need to setup ACCESS_KEY in ipstack to test it:

[{"id":"f2e0329c.73c4e","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"cfbd01d9.4efda","type":"inject","z":"f2e0329c.73c4e","name":"","topic":"","payload":"104.27.163.46","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":310,"y":460,"wires":[["2002343b.9e318c","7cf2a066.8289e","cb1a974f.f068d8"]]},{"id":"2002343b.9e318c","type":"function","z":"f2e0329c.73c4e","name":"geoip-lite","func":"const geoip = global.get('geoipLite');\n \nmsg.payload = geoip.lookup(msg.payload);\n \nreturn msg;","outputs":1,"noerr":0,"x":560,"y":300,"wires":[["6e0f0d03.f28f54"]]},{"id":"6e0f0d03.f28f54","type":"debug","z":"f2e0329c.73c4e","name":"using 'geoip-lite'","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1080,"y":300,"wires":[]},{"id":"7cf2a066.8289e","type":"ip-location-lite","z":"f2e0329c.73c4e","name":"node-red-contrib-ip-location-lite","inputField":"payload","outputField":"payload","x":630,"y":460,"wires":[["fea0b74d.de6a38"]]},{"id":"fea0b74d.de6a38","type":"debug","z":"f2e0329c.73c4e","name":"using 'node-red-contrib-ip-location-lite'","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1010,"y":460,"wires":[]},{"id":"1201e5f0.745bba","type":"http request","z":"f2e0329c.73c4e","name":"ipstack.com","method":"GET","ret":"txt","paytoqs":false,"url":"http://api.ipstack.com/{{ip}}?access_key={{access_key}}&format=1","tls":"","persist":false,"proxy":"","authType":"","x":770,"y":580,"wires":[["d4fa8e70.e25a7"]]},{"id":"d4fa8e70.e25a7","type":"debug","z":"f2e0329c.73c4e","name":"using ''https://ipstack.com/product'","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1020,"y":580,"wires":[]},{"id":"cb1a974f.f068d8","type":"change","z":"f2e0329c.73c4e","name":"set access_key","rules":[{"t":"set","p":"ip","pt":"msg","to":"payload","tot":"msg"},{"t":"set","p":"access_key","pt":"msg","to":"XXXXXXXXXXXXXXXX","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":580,"wires":[["1201e5f0.745bba"]]}]

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.