Skip to content

Latest commit

 

History

History
89 lines (65 loc) · 1.59 KB

geolocation.adoc

File metadata and controls

89 lines (65 loc) · 1.59 KB

GeoLocation

Represents geographical location (defined by latitude and longitude).

Instance attributes

isManual ⇒ Boolean

TRUE if location is entered manually

isValid ⇒ Boolean

TRUE if location is valid

latitude ⇒ Float

Latitude as floating point number

latitudeText ⇒ String

Latitude as text

longitude ⇒ Float

Longitude as floating point number

longitudeText ⇒ String

Longitude as text

timestamp ⇒ Integer

Lat data update timestamp (UNIX format)

type ⇒ Integer

Data source type:

  • 0 – Unset

  • 1 – Manual

  • 2 - GPS

  • 3 - Network

Constructors

GeoLocation(latitude, longitude, type=1)

Create instance of the class based on floating-point latitude and longitude. Optional argument type can be used to override default value 1 ("Manual").

Constants

Table 1. Location Types
Value Description

0

Unset (represents unknown location)

1

Manual (set by system administrator)

2

Automatic (obtained from GPS)

3

Network (obtained from network, for example using WiFi AP database)

Examples

Print node location
>>> nodeLoc = $node.geolocation
>>> println(nodeLoc.latitudeText)
N 48° 00' 0.000"
>>> println(nodeLoc.longitudeText)
E 22° 00' 0.000"
Set node location
>>> nodeLoc = GeoLocation(22.11, 48.12, 1)
>>> $node.setGeoLocation(nodeLoc)
>>> println($node.geolocation.latitudeText)
N 48° 12' 0.000"
>>> println($node.geolocation.longitudeText)
E 22° 11' 0.000"
Clear location
>>> $node.clearGeoLocation()
>>> println($node.geolocation)
null