Report device location via GeoLocation property
Updated at:
The IoT Platform's 2D data visualization service supports device location. You can determine a device's location in three ways: by reporting its coordinates as a device property, by setting the coordinates in the console, or by using cloud-based inference. This topic explains how to locate a device by reporting its coordinates as the GeoLocation property.
If your device has a GPS module, it can report its coordinates directly. If so, follow the procedure in this topic to locate the device using its reported location data.
Procedure
- In the IoT Platform console, create a product. For more information, see Create a product.
Note If a product already exists for your device, you can skip this step.
- In the left-side navigation pane, choose . Find the product for your device and click View in the Actions column.
- On the Product Details page, select the Feature Definition tab and add Standard Features to the product. For more information, see Add a single TSL model.
In the Add Standard Feature dialog box, select Other Type and search for GeoLocation.
- From the search results, click the desired GeoLocation feature to add it to the Selected Features list, and then click OK.
Alternatively, if you prefer not to use a standard feature, you can add a custom feature on the Product Details page. On the Feature Definition tab, in the Custom Features section, add a feature with the following configuration.Note We recommend that you add the GeoLocation property as a standard feature.
Table 1. Parameters Parameter Identifier Type JSON parameter identifier Parameter type Description GeoLocation GeoLocation struct Longitude double The longitude of the device's geographical location. Latitude double The latitude of the device's geographical location. Altitude double The altitude of the device's geographical location. CoordinateSystem enum - 1: WGS_84
- 2: GCJ_02
The coordinate system for the Latitude and Longitude values. Coordinates are meaningful only within a specific coordinate system. - WGS_84: An international standard for latitude and longitude coordinates, also known as the World Geodetic System 1984.
- GCJ_02: A coordinate system formulated by the Chinese State Bureau of Surveying and Mapping. It is an encrypted coordinate system based on WGS_84.
Note- When you define this struct as a custom feature, the Longitude, Latitude, and CoordinateSystem parameters are required. The Altitude parameter is optional. These parameter identifiers are case-sensitive and must be capitalized as shown.
- If you define all four parameters in the TSL model, your device must report all four parameters.
- The device reports its location data to the cloud using a standard device protocol.
The device reporting protocol uses the following topics:
- TOPIC:
/sys/{productKey}/{deviceName}/thing/event/property/post - REPLY TOPIC:
/sys/{productKey}/{deviceName}/thing/event/property/post_reply
The following is a sample request payload.
{ "id" : "123", "version":"1.0", "params" : { "GeoLocation" : { "value":{ "Longitude":39.9935723, "Latitude":39.9935723, "Altitude":39.9935723, "CoordinateSystem":2 } } }, "method":"thing.event.property.post" }For more information about reporting device data, see Device properties, events, and services.
- TOPIC:
Is this page helpful?