cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Steve6
Level: Powered On

Check if location is within a radius

Hi,

I'm trying to figure out a way of checking if location (latitude and longitude) is within a certain radius. If it's not then I'd like to send a notification (using Flow maybe?) and in Powerapps have a formula returning true/false depending on whether the location is within the radius or not. 

 

My location data is in a Sharepoint list in two columns, one for latitude and one for longitude. 

 

Is this possible?

6 REPLIES 6
KickingApps
Level 8

Re: Check if location is within a radius

@seadude - isn't this your specialty?

Highlighted
seadude
Level 10

Re: Check if location is within a radius

Smiley Happy I'm working on something similar using the Azure Maps API. I haven't yet tried the GeoFence API (which looks like exactly what you want).

Rather, I've been focused on drawing a circular path, define a radius and Pins on a map.

Example of what I got so far:

image.png

API Docs: https://docs.microsoft.com/en-us/rest/api/maps/render/getmapimage

YouTube Live Coding session creating this Custom Connector.

Check out the resources above and holler with questions!

Community Support Team
Community Support Team

Re: Check if location is within a radius

Hi @Steve6 ,

Do you want to check if a location is within a radius?

 

If you want to check if a location is within a radius within PowerApps, and if not, send a notification email, I afraid that there is no direct way to achieve your needs.

Currently, within PowerApps, there is no function supported to check if a location is within the radius or not.

 

If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Steve6
Level: Powered On

Re: Check if location is within a radius

@seadude 

Thank you for the answer, sorry for me taking so long to reply. I've watched your video and learned quite a bit!

 

Now I tried using the suggested GeofenceAPI. I uploaded a Polygon using the Data - Upload API in Postman.

The upload API is set to POST https://atlas.microsoft.com/mapData/upload?subscription-key=xxx&api-version=1.0&dataFormat=geojson and the body is an example body from GeofenceAPI:

{
  "FeatureCollection": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "geometryId": 1001
        },
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [
              [
                -111.9267386,
                33.5362475
              ],
              [
                -111.9627875,
                33.5104882
              ],
              [
                -111.9027061,
                33.5004686
              ],
              [
                -111.9267386,
                33.5362475
              ]
            ]
          ]
        }
      }
    ]
  }
}

That works alright, I get a 202 and when I check with  GET https://atlas.microsoft.com/mapData/UdidFromUploadData/status?api-version=1.0&subscription-key=xxx I get 200. 

 

When I change the polygon to my custom polygon like this:

{
  "FeatureCollection": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "properties": {
          "geometryId": 1001
        },
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [
              [
                49.1694071,
                16.5487161
              ],
              [
                49.2408981,
                16.5387291
              ],
              [
                49.2379711,
                16.6774391
              ],
              [
                49.1597681,
                16.6720481
              ]
            ]
          ]
        }
      }
    ]
  }
}

with DataCheck I get 400 BadRequest: "Upload request failed.\nYour data has been removed as we encountered the following problems with it:\nSystem.Threading.Tasks.Task`1[System.String[]]". I've tried so many times and I can't figure out how the change of the polygon causes this error. 

seadude
Level 10

Re: Check if location is within a radius

Hi @Steve6 . Nice work starting off with the geofencing API! I was intimidated by it, so you're really pioneering here! I'd recommend hitting that Azure teams Github Issues area with a link to your post here. I've found the Github Issues are VERY promptly responded to.

If I can find the time, i'll dabble as well. @KickingApps has me working with the Azure Maps POI Search and Map Rendering at the moment Smiley Happy

Keep us posted!

Steve6
Level: Powered On

Re: Check if location is within a radius

@seadude thank you for the suggestion!

Here's a link to the issue: https://github.com/MicrosoftDocs/azure-docs/issues/32826 

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 110 members 3,535 guests
Please welcome our newest community members: