# Gateway GPS configuration in local\_conf.json

**URL:** <https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176>\
**Category:** Uncategorized\
**Created:** [March 21, 2017, 12:57pm UTC](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176 "2017-03-21T12:57:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpmeijers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/jpmeijers/32/44875_2.png) [@jpmeijers](https://www.thethingsnetwork.org/forum/u/jpmeijers)\
**Post date:** [March 21, 2017, 12:57pm UTC](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176/1 "2017-03-21T12:57:03Z")

</div>

Tags: location, gps, coordinates, local\_conf

![](https://www.thethingsnetwork.org/forum/uploads/default/original/2X/f/fd25d8f5da0606bdd0cf3c98243ebb485584a292.png)

To be consistent with the GPS coordinates for a gateway, we need to standardise the flow and origin of manually set coordinates. The flowchart above basically says that coordinates should always be set on the TTN console, unless the gateway has a GPS. In all other cases you should configure the gateway in such a way that either it does not send coordinates to the backend, in which case the coordinates from the console will be used, or fetch the coordinates from the console.

**Single channel gateways**  
For gateways that does not have a local\_conf.json, or does not have the ability to disable sending coordinates in status update packets, set:  
`latitude=0`, `longitude=0`, `altitude=0`.  
When these values are 0, they will be replaced by the values defined on the console.

**Location privacy**  
If you want your gateway’s location to appear on [https://www.thethingsnetwork.org/map](https://www.thethingsnetwork.org/map) or on [https://ttnmapper.org/](https://ttnmapper.org/) you need to make your gateway location public by changing the setting on the console.

Please feel free to comment on this and I will update the flowchart if necessary.

---

<div class="post-metadata">

**Author:** ![gonzalo](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/gonzalo/32/40499_2.png) [@gonzalo](https://www.thethingsnetwork.org/forum/u/gonzalo)\
**Post date:** [April 1, 2017, 4:12pm UTC](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176/3 "2017-04-01T16:12:20Z")

</div>

I would suggest a different system. Being able to set everything about a gateway without opening the console is a big plus, and we could keep that if only we agree that there’s a hierarchy: values set in the console take precedence over local configuration. I assume this flowchart was designed to support real GPS, but I would suggest that still works: one must simply not set location on the console if the local GPS is preferred.

---

<div class="post-metadata">

**Author:** ![htdvisser](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/htdvisser/32/45312_2.png) [@htdvisser](https://www.thethingsnetwork.org/forum/u/htdvisser)\
**Post date:** [May 26, 2017, 12:43pm UTC](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176/4 "2017-05-26T12:43:03Z")

</div>

Copy of my [comment on Github](https://github.com/TheThingsNetwork/ttn/issues/543#issuecomment-304268468):

Here are the rules for gateway location:

For the gateway:

- If the gateway **has a GPS** and **has a GPS fix** :
  - The gateway **must** add the location calculated from GPS to status messages as `status.gps`
  - The gateway **must** add the `time` field to uplink messages as `message.gateway_metadata.gps.time`
  - The gateway **may** add the `gps` field to uplink messages as `message.gateway_metadata.gps`

- In all other cases:
  - The gateway **must not** add a location to the status messages.
  - The gateway **must not** add a `time` field to uplink messages.

For the backend:

- Each time the gateway sends a status message, a location is cached as “latest”
  - If the status message contains a location, the location from the status message **must** be cached.
  - If the status message does not contain a location, but the gateway location is set in its registration, the registered location **must** be cached.
  - In all other cases, the location **must** be stored as “empty”.

- Each time the gateway sends an uplink message:
  - If the metadata of the uplink message contains a `gps` field, this field **must not** be changed
  - If the metadata of the uplink message does not contain a `gps` field **and** the “latest” status message from the gateway contains a location, the “latest” location **must** be inserted.
  - In all other cases, the location **must** remain “empty”

Note: The `fake_gps` option must only be used if the gateway has some other means to determine an accurate location
