Swift: Maps: How to tell next intersecting street on my route - ios

I am writing an iOS app in swift. I need to be able to tell at any given point in time what street will be intersecting next on my user's route who is driving/walking.
I am able to find the street name user is currently on, the direction user is moving in and also the current coordinates but the last step stumps me: which street will intersect next?
I am open to using Apple Maps, Google Maps, OSM etc as long as it if free.

Your best bet is to use https://developers.google.com/maps/documentation/directions/
The idea is to get the legs of the directions and then determine in which leg you are currently in which you can do since you know the current street name you are in and then find the info about the next leg. It may not always be accurate but its the easiest way that you can find which street will intersect.
You can either use the Driving or Waypoints api.
Hope this helps.

Related

How to get near by places in radius of 2 kilometer from current location without using Google API in iOS Objective C

I am developing a Map based iOS app in Objective C. Basically what I need to achieve is to get the details data of suggested location that is within 5 kilo meter to the current user location without using Google API. I have searched a lot but could not find any answer to my question.
I tried below links related to my problem but could not get satisfactory solution :
how to find nearest latitude and longitude form current place?
get nearest locations from my current location
http://api.geonames.org/findNearbyPlaceNameJSON?lat=12.9972&lng=77.6143&radius=5&username=demo
How to get the nearest area from a list of locations?
I want to know if there is some other good and efficient approach (free).
Thank You !
If you have the coordinates of all the places you want to search from in database, then you can implement Haversine formula in sql query and this will return results within the specified distance as in your case 2km.Refer to this link for detailed information.

Best solution for iOS Mapping multiple latitude and longitude points

What would be my best option if i want to map multiple lat, longs onto a map within an iOS App?
I have hundreds of points captured from a GPS receiver over an hours walk. Does anyone have any thoughts on how to best ingest all these points and spit out a map with the exact route followed??
Any help with this would be great. Is there anyway i can provide all the data points to the Google Maps API and they return a map plus meta data for things like total distance?
What have you tried so far? What part are you unsure about? How do you want to display the route and when?
As far as I understand, you are saving coordinates to a database at a defined interval. We don't know at what frequency. You will be able to display each point on a map, and eventually link them alltogether with a polyline. But that won't follow roads. For this you would need to use the Directions service. But this service has limitations:
You cannot assume that giving the service your start and end coordinates it would calculate the same route that you followed.
You can give the service a few waypoints but you are limited to 8 waypoints per request (with the free API).
The free API allows for 2500 requests per day / 10 per second.
Let me know if there is anything else I can help you with.

How to know a location ( like : (CLLocation *)newLocation)) whether on the road?

I was doing a map ios app using CLLocation and I was wondering whether there is an API for judging whether a point on the map is on the road, but not in an appartment or in anywhere in-side the house?
I have seen there are certain navigation application who can keep the points on the road.
https://github.com/route-me/route-me
Have a look there are so many example in this code you will an google api which provides us the route path latitude and longitutude and we draw a over lay on the map.
Hope this will help you.

How do I determine if a user is traveling along a specified route and in which direction?

Assume I have established a navigation route on a service like google maps. How do I determine if a user is traveling along that route and in which direction? Sort of like a GPS device knows if you are following the specified route or not, but also with heading info.
I'm a python hacker, but examples or resources in any language would be fine.
Thanks in advance!
You would have to log a users current geolocation and the timestamp of that entry intermittently, say every ten seconds or so.
At that point you would then have the information you need to calculate and get the final data that you need.
A good place to start is the calculating bearing section in Calculate distance, bearing and more between Latitude/Longitude points.

Bing API for finding nearby cities

Is there a Bing API for finding nearby cities given a city name or lat/long combination?
I don't know if Bing provides this, but you build your own from the data available from geonames.org
They provide an API to get places near a given lat/lng: http://api.geonames.org/findNearby?lat=47.3&lng=9&username=demo
Or you can also go all out and implement a solution for your own needs using their data, as per this answer: Given the lat/long coordinates, how can we find out the city/country?
I think this is what you're looking for: Bing Maps API Sample
The short answer is no, there is no Bing API for finding nearby cities.
That said, it would be possible to 'cook your own' using the existing APIs. However, one thing that would need clarification is what 'nearby' means. I presume you mean within a specific radius of a given point (determined by a city name or lat/long combination).
Using the Bing Api it would be fairly trivial to implement an algorithm to reverse geocode a location and then test for places within x distance.
Failing that, you could use something like geoPlugin, it is free and you can put it on your sever - thus avoiding 3rd party up-time issues.
http://www.geoplugin.com/webservices/php#php_class
Take a look at the nearby places features, this does exactly what you want.
http://www.geoplugin.com/webservices/extras
No, there isn't. However, it's relatively simple to get the bounding box for a given coordinate and then use the Bing Maps API with that. I'm doing this and used this solution to get what I needed...
https://stackoverflow.com/a/14314146/73680

Resources