Link Search Menu Expand Document

Point of Interest Entity Functions

Sep 28 2022 at 12:00 AM

  1. Get Nearest Point Of interest Distance

Function Description:

The POI Entity Function allows you to get the nearest location from specific Latitde and Longitude coordinates. The location data is sourced from a repository of GPS coordinates with friendly names attached to each coordinate. You can also set a maximum distance within which to search for a location.

Function Structure:

Figure 1 - Point of Interest Function

Inputs Required:

  • Value 1 - Latitude
  • Value 2 - Longitude
NOTE
The value for each function is a GPS coordinate. You can use an endpoint that is pulling live GPS coordinates from a gateway or you can create a From latitude and longitude entity function for each value. You can then set a link to this entity function.

Output Expected:

  • String - POI Location Name.

OPTIONAL

  • Maximum Distance: Set in meters or -1 to disable.

Managing POIs:

The Points of Interest can be managed using Commander™ API calls. Please refer to the Point Of Interest API documentation to populate your repos with the location data.

Use Case Scenario(s):

The purpose of this function is to find the closest point of interest to a dynamically changing set of coordinates, such as a mobile generator that is constantly moved around. You can also set a specific search radius if you need to restrict the maximum distance that must be searched.

In our mobile generator example, we want to search for the closest point of interest to the mobile generator when it is needed. This means that the mobile generator needs to use its own location to get the nearest Point of Interest’s name, so that it can get assigned to location.

An optional radius value, measured in meters, can also be specified to restrict the search area or it can be disabled by using a negative value -1

Site 1 is registered as the following point of interest:

  • Name: “ClientSite1”
  • Coordinates:
  • Longitude: 28.208645
  • Latitude: -25.863738

Site 2 is registered as the following point of interest:

  • Name: “ClientSite2”
  • Coordinates:
  • Longitude: 28.218895
  • Latitude: -25.856232

These sites are added into a repository from which the function calculates the values. The mobile generator (or GPS location) we wish to find the nearest point of interest for, will use the function with the following input:

  • Coordinates:
  • Longitude: 28.208863
  • Latitude: -25.864814
  • Radius:

1000 (or -1 if radius is not required) The output will then be “ClientSite1”

How to create a POI Entity Function

1. From within Commander™ Portal, go to Entity Management page and select the entity you want to create a POI Entity Function for, or create a new one by clicking the New Entity button at the top of the column.

NOTE
A function allows you to edit incoming data and output a specific value.

2. A new screen will pop up where you can enter the Name for your new POI Entity Function as well as the Entity Type, here you can select Entity Function then click save and close.

3. Now we need to create endpoints for Latitude and Longitude positioning so that we can manage the data for these values, be it a static or dynamic set of coordinates. To do this click on the new New Entity button and select Endpoint. Name the first Latitude and the second Longitude. For both, choose Static from the Entity Sub-Type dropdown box and Double as the Data Type. Click Save and Close when you are done.

4. Next we’ll be editing the POI function that we created and add the Latitude and Longitude endpoints we created. In the Entity Properties screen of your POI entity, click on the Edit Function button.

5. From the function groups on the left panel, click on PointOfInterest and drag Get nearest point of interest name to the funtion box on the right panel. The function will be automatically built and you just need to enter the Value and Maximum Distance data.

5. We will use the Latitude and Longitude functions we created. Choose From Latitude and longitude from the GPS function group and drag it onto the Value input box.

6. For the Maximum distance input, click on the Constants function group at the top of the page and drag New constant onto the placeholder. You’ll now be able to enter a Double or Int value, in meters, to set the radius for the POI search. You can disable the maximum distance radius by entering -1.

7. If the functions works correctly, you’ll see the POI Location Name in the Last Value output box on the POI Entity Properties page.

Get Nearest Point Of interest Distance

Function Description:

The distance between an object and destination, based on the Geo-location difference.

Function Structure:

Distance = Distance (parameter 1: GPS-Coordinate Lat 1, parameter 2: GPS-Coordinate 2 Lon + POI Name)

Use Case Example(s):

GPSGet nearest POI distance Return
45.393780Mobile Generator A
-79.317108 

Use Case Scenario (s):

1.The location of Base station 1 is located at Lon (x) and Lat (x), the nearest Mobile generator is (x) meters away from this location