GeoLocation
Represents geographical location (defined by latitude and longitude).
Instance attributes
- isManual: bool
-
TRUEif location is entered manually
- isValid: bool
-
TRUEif 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: int
-
Last data update timestamp (UNIX format)
- type: int
-
Data source type:
-
0 – Unset
-
1 – Manual
-
2 - GPS
-
3 - Network
-
Constructors
- GeoLocation(latitude, longitude, type=1, timestamp, accuracy=0)
-
Create instance of the class based on floating-point
latitudeandlongitude. Optional argumenttypecan be used to override default value 1 ("Manual"); values outside the 0-3 range are replaced with 1. Optional argumenttimestampsets the location update time (UNIX format, current time if omitted), andaccuracysets location accuracy (default 0).
Constants
| 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
>>> nodeLoc = $node.geolocation >>> println(nodeLoc.latitudeText) 48°00'00.000"N >>> println(nodeLoc.longitudeText) 22°00'00.000"E
>>> nodeLoc = GeoLocation(48.2, 22.25, 1) >>> $node.setGeoLocation(nodeLoc) >>> println($node.geolocation.latitudeText) 48°12'00.000"N >>> println($node.geolocation.longitudeText) 22°15'00.000"E
>>> $node.clearGeoLocation() >>> println($node.geolocation) [undefined]