I was creating an app that would give a random restaurant near me and give the distance to that restaurant. I was having issues getting the distance to work so I contacted my professor and we debugged the program until we saw that iOS was having an issue converting degrees to radians. I will attach the code we used as well as the test in two images.
Welcome @ItsVenyou
Did you try your solution using an Android or only tested on ios? Does your algorithm work correctly on an Android? (this will indicate whether the problem is an issue with your algorithm or with ios,) or did you forget something?
Here are several examples that calculate distance (straight line distance) between coordinates that definitely work on Android devices, using different methods.
To calculate distance between the two locations, use one of the methods shown here
An example that calculates a distance matrix isSocial Distancing ... a CloudDB / Location Marker Tutorial
An easy way to create a map from a List of Markers (not a kml or geojson) is shown in the National Parks tutorial. The tutorial demonstrates how to plot multiple run time markers using a csv file to an OpenStreetMap. Use the list from csv Block to convert the csv to a List. What you do depends on how you make your List, where it is stored or is downloaded from. That tutorial might be a good starting point to learn about using the App Inventor Map creation tools. It calculates your distance from your location to all the map Markers and indicates the closest destination marker.
A good way to get directions from one place to a Marker and the actual driving distance (not straight line distance) is described in HOW TO: Use the Navigate control
We used the aiStarter emulator which is Android and tested on my IPhone 11. The screenshot is from my IPhone.
When you tested on the Android emulator and ran the Project, did the algorithm correctly calculate distance? Here is how to run the emulator to test your app as an Android app Instructions
Did you fix your Blocks as indicated above? Perhaps just fix and try.
The emulator worked fine. We worked around it by manually converting degrees to radians.
Thanks for reporting this. I've confirmed that the block is not returning the correct values on iOS. We will take a look and prepare a fix.