# 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:** 1\
**Showing post:** 4

<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

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/gateway-gps-configuration-in-local-conf-json/6176)._
