Difference between revisions of "NXSL:GeoLocation"
Jump to navigation
Jump to search
Tomas Kirnak (talk | contribs) (Added examples) |
|||
Line 45: | Line 45: | ||
| 3 || Network (obtained from network, for example using WiFi AP database) | | 3 || Network (obtained from network, for example using WiFi AP database) | ||
|} | |} | ||
===Examples=== | |||
'''Getting node location''' | |||
<pre> | |||
nodeLoc = $node->geolocation; | |||
println("Node latitude: " . nodeLoc->latitudeText); | |||
println("Node longitude: " . nodeLoc->longitudeText); | |||
</pre> | |||
Output: | |||
<pre> | |||
Node latitude: N 48° 00' 0.000" | |||
Node longitude: E 22° 00' 0.000" | |||
</pre> | |||
'''Setting node location''' | |||
<pre> | |||
nodeLoc = GeoLocation(22.11, 48.12, 1); | |||
$node->setGeoLocation(nodeLoc); | |||
</pre> | |||
'''Clearing node location''' | |||
<pre> | |||
$node->clearGeoLocation(); | |||
</pre> |
Revision as of 01:34, 18 January 2016
Represents geographical location (defined by latitude and longitude).
Class Name
GeoLocation
Constructor
GeoLocation(latitude, longitude, [type]);
If type is omitted 1 (manual) will be used.
Attributes
Name | Type | Description |
---|---|---|
latitude | real | Latitude as floating point number |
latitudeText | string | Latitude as text |
longitude | real | Longitude as floating point number |
longitudeText | string | Longitude as text |
type | int32 | Location type |
Possible location types are:
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
Getting node location
nodeLoc = $node->geolocation; println("Node latitude: " . nodeLoc->latitudeText); println("Node longitude: " . nodeLoc->longitudeText);
Output:
Node latitude: N 48° 00' 0.000" Node longitude: E 22° 00' 0.000"
Setting node location
nodeLoc = GeoLocation(22.11, 48.12, 1); $node->setGeoLocation(nodeLoc);
Clearing node location
$node->clearGeoLocation();