mirror of
https://github.com/drygdryg/netbox-plugin-device-map.git
synced 2024-11-30 06:00:52 +03:00
Make sure Lat and Long are the right way around!
This commit is contained in:
parent
edada1df35
commit
93f4691729
@ -15,8 +15,8 @@ LatLon = tuple[float, float]
|
|||||||
|
|
||||||
def get_device_location(device: Device) -> LatLon | None:
|
def get_device_location(device: Device) -> LatLon | None:
|
||||||
"""If netbox longitude and latitude fields are populated for a device then use them."""
|
"""If netbox longitude and latitude fields are populated for a device then use them."""
|
||||||
if device.longitude and device.latitude:
|
if device.latitude and device.longitude:
|
||||||
return (device.longitude, device.latitude)
|
return (device.latitude, device.longitude)
|
||||||
"""... Otherwise extract device geolocation from special custom field"""
|
"""... Otherwise extract device geolocation from special custom field"""
|
||||||
if location_cf := device.custom_field_data.get(LOCATION_CF_NAME):
|
if location_cf := device.custom_field_data.get(LOCATION_CF_NAME):
|
||||||
return tuple(map(float, location_cf.replace(' ', '').split(',', maxsplit=1)))
|
return tuple(map(float, location_cf.replace(' ', '').split(',', maxsplit=1)))
|
||||||
|
Loading…
Reference in New Issue
Block a user