# Impossible to send lat and lon to darksky node

**URL:** <https://discourse.nodered.org/t/impossible-to-send-lat-and-lon-to-darksky-node/11262>\
**Category:** General\
**Created:** [17 May 2019 21:43 UTC](https://discourse.nodered.org/t/impossible-to-send-lat-and-lon-to-darksky-node/11262 "2019-05-17T21:43:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike67](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@mike67](https://discourse.nodered.org/u/mike67)\
**Post date:** [17 May 2019 21:43 UTC](https://discourse.nodered.org/t/impossible-to-send-lat-and-lon-to-darksky-node/11262/1 "2019-05-17T21:43:43Z")

</div>

Hello  
I try to use the darksky node  
For this, I send msg.location.lat and msg.location.lon in a function node, and I send it with an inject node.  
`[{"id":"87c62aba.34caa8","type":"inject","z":"42048d2a.145da4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1140,"y":680,"wires":[["e5fecf71.d830d"]]},{"id":"e5fecf71.d830d","type":"function","z":"42048d2a.145da4","name":"","func":"msg.location.lat = \"50.0\"\nmsg.location.lon = \"4.0\"\nreturn msg;","outputs":1,"noerr":0,"x":1270,"y":680,"wires":[["c830f6ce.1e3398","28223e7a.0300c2"]]},{"id":"c830f6ce.1e3398","type":"darksky","z":"42048d2a.145da4","darksky":"","name":"","lon":"","lat":"","date":"","time":"","mode":"node","lang":"en","units":"us","x":1560,"y":520,"wires":[["6adaee8e.3be07","400bd68e.b1d5f8","4b65a4c4.1dadcc","9d8aa341.55a89","74f8cb95.9c1b04","76ae3e4b.cc65c","74bd0aee.633ef4","4abf0809.18bc28","fd928704.85caf8","f0573735.6ede78","e6d55fd6.3afd1","13d4acba.ea3ea3"]]}]`  
But I get an error from the darksky node 🙂

```auto
17/05/2019 à 23:43:36[node: e5fecf71.d830d](http://192.168.1.10:1880/#)function : (error)

"TypeError: Cannot set property 'lat' of undefined"

```

Can you tell me my error?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 May 2019 22:03 UTC](https://discourse.nodered.org/t/impossible-to-send-lat-and-lon-to-darksky-node/11262/2 "2019-05-17T22:03:50Z")

</div>

You need to define msg.location before defineing it's parts. So you could do  
`msg.location = '';`  
first or define location as an object with

```auto
msg.location = {"lat" : 50.0,
                "lon" : 4.0}

```

---

<div class="post-metadata">

**Author:** ![mike67](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@mike67](https://discourse.nodered.org/u/mike67)\
**Post date:** [19 May 2019 20:00 UTC](https://discourse.nodered.org/t/impossible-to-send-lat-and-lon-to-darksky-node/11262/3 "2019-05-19T20:00:05Z")

</div>

Once more, thanks a lot for your knowledge and help.
