Schlaubischlump / LocationSimulator

MacOS application to spoof / fake / mock your iOS / iPadOS or iPhoneSimulator device location. WatchOS and TvOS are partially supported.
https://schlaubischlump.github.io/LocationSimulator/
GNU General Public License v3.0
2.39k stars 184 forks source link

[Feature - Discussion] Roughly Conform to Speed Limits in Drive Mode #139

Open daturadev opened 1 year ago

daturadev commented 1 year ago

First of all, I love this application. Beautifully designed.

Lately, I've been considering doing some research and figuring a way to adjust speeds based on current roads/highways being traveled - adjusting to walking speeds if ever off-road, varying over/under the speed-limit in a realistic fashion. This would require me to research the source code and learn how the GPS manipulation works - if it is even possible to scrape speed-limits using whatever API/module/framework is used in this application. I am willing to contribute, but it would take a considerable amount of time to do on my own.

Does anybody else think this concept is worth implementing? Anyone interested in contributing? I think this would add an insane level of realism to the application.

Schlaubischlump commented 1 year ago

Hi @daturadev,

Great that you like the application !

I have thought about this feature, but sadly I don't have time to implement it myself and do the necessary research to find a working API.

Information

The speed handling is done in the LocationSpoofer library which you can find on my github page as well. The LocationSpoofer class has a speed property which you can change while the location is updated.

Internally the route is calculated using MapKit (provided by Apple). MapKit does not provide a way to get a speed limit or information about the route you are traveling on.

How could this feature be implemented?

  1. Find an API that provides speed limit information (OpenStreetMap probably has one)
  2. Get the current spoofed location from the LocationSpoofer instance
  3. Use the API in 1 to fetch the speed limit for the current location retrieved in 2
  4. Change the speed property of the LocationSpoofer instance to the speed limit retrieved in 3
  5. Repeat step 1 to 4 if the location was changed successfully (or changed significantly) or after a period of time to update the speed limit

If you or someone else feels up to the task to implement a prototype feel free to ask me for support.

Edit: Maybe the Overpass API could work:

Overpass Example: https://stackoverflow.com/questions/15749133/get-speed-limits-from-openstreetmap

Swift API: https://github.com/younata/SwiftOpenStreetMap