Check if a location exists in a route in Map API - ios

I'm using MapBox iOS SDK for showing route between two locations. I would like to know if there is any possibility to check whether a location lies in a route.
I need this functionality so that if any incident happen one location and if that location lies in the route, I need to alert the user about this and need to show the alternate route.
For e.g.:- Say I have plotted a route between location A and location B. I want to check if location C lies in the route between A and B. Any suggestion from MapBox Api or google maps Api is welcomed.

you can get a list of coordinate from mapbox route, then i think calculate distance from points to your interested point. it can yield an acceptable result

Related

Use Custom Route with Google Maps or Apple Maps (iOS)

I am working on a project that involves computing a custom route from a particular origin position to a destination on a map. Ideally, this application should be able to give live walking/driving directions for this custom route, or it should able to send this route to the Google Maps or Apple Maps apps to handle the navigation.
Is there a way to accomplish this using the Google Maps SDK or with Apple'sMapKit (or any other framework)? In theory, for short routes, this could be accomplished using the Google Maps waypoints feature, where points along the desired route are pre-specified, but the API is limited to 23 waypoints, which would become problematic quite quickly.
In essence, I want something like Google Maps, but with the route determined by my own algorithm rather than Google's.
For custom routes, you could use something like Skobbler or MapBox.

Get directions for an existing polyline path?

Using the Google Directions API you can provide a starting latitude and longitude and a destination latitude and longitude and get back walking directions from the start to end location. This provides you with the route the user can take and you draw that route on the map then show them the directions. That works, but what if you already have a route drawn on the map? Can you get directions given an existing GMSPath and GMSPolyline?
You can imagine an app that allows users to draw a route on the map they want to take then get walking directions for that route, instead of getting directions for a route Google suggests. How can that be accomplished? If Google doesn't offer that ability, is there another service that can give you directions given an existing route?
I think the best option would be to use each point from your polyline as a waypoint when calculating directions. Depending on your polyline though, it may not follow the same path exactly, but it should be pretty close.

ios - How to get turn-by-turn directions of an specific route?

I have a MKPolyline that I want MKMapkit to give me the turn-by-turn directions.
I know there is a way to get all the possible routes from point A to point B, but in my app I need to be able to provide turn-by-turn directions of route with certain restrictions:
Has to go through a certain street.
Avoid certain streets
Avoid lights
Take some detours, for sightseeing.
So is there a way to ask for trun-by-turn directions with restrictions?
Or can I ask turn-by-turn directions of a specific polyline that I know?
The Apple directions API (MKDirections / MKDirectionsRequest) can give you directions from point A to point B, but does not allow any other restrictions to be placed on the route.
The Google Directions API (not part of the Google Maps SDK, but can be used through standard HTTP requests) does allow more restrictions, but not to the level you require.
It does allow you to add up to 8 waypoints, so this would allow you to specific specific streets or detours in the directions request. It also allows you to avoid toll roads or motorways. It does not allow you to avoid certain streets or lights - I don't know of any directions API that has that level of detail.
One other restriction of using Google Directions API is that you must show the results on a Google map.

Ruby on Rails and gmap location

I come here to ask you some informations or maybe help to try to do what i want.
Here it's what i want to realize:
I have a website and on it i have some places in database (with lattitude and longitude saved). I want allow users, when they click on a button, display a map with a marker on their actual position and others markers who will represent the places from the database near them.
I found some tools like google map API v3. With it i can show the user position but i don't know how i can display the position of the places store in my database.
If you have any ideas or examples.
Thank you.
(PS: Sorry for my english)
I built a similar app with Spring and Java. What you'll have to do is create Placemark JS objects and pass them to the Google Maps API. You can also pass a map size to determine the scope of the map returned to the user.
In order to determine nearby locations, simply build some ruby/rails code to limit the distance of locations from the user location.
Get user location
Determine which locations to show on map within your rails app
Pass desired placemarks to Google Maps (This can be found in API docs which are great)
Display the map returned by Google Maps on a view.
I think you could use geocoder gem for that:
http://www.rubygeocoder.com/

Options for displaying multiple routes on iPhone Map (iOS 4+)

I am trying to develop an iPhone app (with map routing function), and I need everyone's suggestions (guidance).
Below are a few specs:
The app will be running on iPhone with iOS 4+.
The app will have Map functionality.
In the app, given a "few locations" in a given order (to make things less complicated), the Map will draw routes between each locations on the Map.
Clicking on any location will display another page that shows some information about that location.
Can choose alternative route between two location (which I don't think is possible, but let me know if anyone know any framework that can do this).
I did some research, using Map on iPhone is easy using MapKit (and it's available after iOS 3.0). I followed this tutorial, and everything seems easy. However, if I want to draw routes on my map, I will need routes data in a CSV format. However, I do not have those data (yes! I suck).
And prior to iOS 5.1, MapKit use Google Maps, and I read somewhere that in Google Map's term and condition of use, it prohibit people from drawing on the Map (correct me if I am wrong).
In order to retrieve route data, I would imagine that I will have to get it through Google or Apple (I don't know if it's possible). I'm just wondering if Apple Map or Google Map have API to retrieve these?
If not, an alternative I came up with is to use a webview, and display my Map routes on Google Map. I'm just wondering if Google Map API will allow me to insert multiple locations and display all the routes?
I really need some suggestions... I am getting buried in all these problems.... thank you
Follow this sample - MKOverlay is the way to go. One more example is here.

Resources