I am attempting to build a school district bus stop locator app that works the same way as a store locator app.
I am using instructions on this article to display the address on a Bing Map in my Power App via Image Control. This is working correctly.
I then have a gallery with all the bus stops. There is a column for latitude and a column for longitude. I'm using this column to calculate the distance, which I added as a new field in the gallery:
ACOS(Cos(Radians(90-DeviceLat))*Cos(Radians(90-ThisItem.Latitude))+Sin(Radians(90-DeviceLat))*Sin(Radians(90-ThisItem.Latitude))*Cos(Radians(DeviceLong-ThisItem.Longitude)))*6371
I don't want it to be DeviceLat or DeviceLong, but instead, use the Lat and Lon of the location entered in the text box (txtLocation).
I'm attempting to use this formula in a text input on a hidden page (the same one I configured to create the Bing Maps Image Control): BingMaps.GetLocationByAddress({addressline:txtLocation.Text, locality:"Houston,TX", countryRegion:"USA"}).point.coordinates.latitude
This is returning errors.
Is there a way I can create Latitude and Longitude fields from the txtLocation box so that I can accurately calculate the distance? Is there an easier way to do what I'm trying to do?