# Node flow to convert ip to coordinates?

**URL:** https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852
**Category:** General
**Created:** [5 June 2020 19:24 UTC](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852 "2020-06-05T19:24:46Z")
**Posts on this page:** 3
**Page:** 2

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [10 June 2020 22:00 UTC](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/21 "2020-06-10T22:00:10Z")

</div>

> [@ristomatti](#):
>
> Just push to npm!

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/3748fd5f3eb363568e577a52140ad070d12d349a.png)

@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 ....

---

<div class="post-metadata">

### Author: ![Jacq](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jacq/32/23906_2.png) [@Jacq](https://discourse.nodered.org/u/Jacq)
#### Post date: [13 June 2020 11:36 UTC](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/22 "2020-06-13T11:36:41Z")

</div>

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

- [Use external service api](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/2), such as [https://ipstack.com/product](https://ipstack.com/product) (nice free plan by the way)
- [Use standard npm function geoip-lite](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/4), as a global ref and the require it in a function.  
[Use new ip-location-lite module](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/21) from @BartButenaers that already includes geoip integration and optionally database update (free account require).

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/c/ec9a220587d839e05a11030b0b43c8eb0b557fd0.png)

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"]]}]`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [27 June 2020 11:36 UTC](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852/23 "2020-06-27T11:36:45Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/node-flow-to-convert-ip-to-coordinates/27852.md?page=1)
