Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Zero coordinates not replaced by console coordinates #604

Closed
jpmeijers opened this issue May 15, 2017 · 2 comments
Closed

Zero coordinates not replaced by console coordinates #604

jpmeijers opened this issue May 15, 2017 · 2 comments
Assignees

Comments

@jpmeijers
Copy link
Contributor

This is a bug report for the backend.

What do you want to do?

On some gateways you can not disable "fake gps", and the workaround is to set the coordinates to lat=0 and lon=0.

What steps did you take?

Using the packet forwarder from: https://github.com/tftelkamp/single_chan_pkt_fwd
Set the coordinates to zero:

// Set location
float lat=0.0;
float lon=0.0;
int   alt=10;

Run the packet forwarder and the packets that are sent out looks like this:

{"stat":{"time":"2017-05-15 14:29:06 GMT","lati":0.00000,"long":0.00000,"alti":10,"rxnb":0,"rxok":0,"rxfw":0,"ackr":0.0,"dwnb":0,"txnb":0,"pfrm":"Single Channel Gateway","mail":"[email protected]","desc":"My gateway"}}

On the NOC you see:
{"id":"eui-xxx","status":{"time":"xxx","gps":{"latitude":0.0000012673606,"longitude":0.000002682209,"altitude":10}

What went wrong or what is missing?

Because I sent "0.00000" rather than "0" as the lat and lon, it gets rounded off and not interpreted as "Null".
The coordinates are then not replaced by the values from the Console.

After we forced the gateway to send coordinates as "0" and not "0.00000" (what sprintf gives out), it worked fine.

Can you fix this yourself and submit a pull request?

In this specific case it was fixed on the gateway side, but because it is an issue that can happen in other software too, it will be better to also fix this in the bridge/router.

Recommendation

I think it would be a good idea to filter all invalid coordinates, or coordinates that are likely incorrect and replace them by the coordinates from the console. The following are incorrect coordinates:

  • latitude > 90
  • latitude < -90
  • longitude > 180
  • longitude < -180
  • -1 < longitude < 1
  • -1 < latitude < 1

For another description of this issue see:
tftelkamp/single_chan_pkt_fwd#17

@htdvisser
Copy link
Contributor

The backend sees this as a "set" location because the GPS location is actually set by the gateway (the altitude is not 0). I agree that it might be good to check for invalid coordinates, so I will add that. Furthermore, I will separate the lat/long from the altitude. This will be done in TheThingsNetwork/gateway-connector-bridge

@htdvisser htdvisser self-assigned this May 18, 2017
htdvisser added a commit to TheThingsArchive/gateway-connector-bridge that referenced this issue May 18, 2017
- If gateway sends valid GPS location, use that
- If gateway sends invalid GPS location, unset location
- If location set in AS (through console), use that

Resolves TheThingsArchive/ttn#604
@htdvisser
Copy link
Contributor

Resolved by TheThingsArchive/gateway-connector-bridge@e4968ac

Not yet deployed, so you might still see this issue

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants