I have drawn a route between the source point to the destination point and I have also found the distance between them by using CoreLocation Framework method "distanceFromLocation", but now I want to find time duration of covering a distance between these two points.
I have seen many guidelines but I have so far failed to get any solution. Can anyone please guide me to a solution or help answer how to do this?
Thanks in advance.
You probably want to build a route from source to destination point. You can do it either using Apple Maps or google maps. If you choose apple maps then you need to construct MKDirectionsRequest object (see documentation). When you get a response you can check routes that Apple suggests you in MKDirectionsResponse object. Each MKRoute object has an expectedTravelTime property
Related
Is it possible to calculate Isochrones using Apple Mapkit? I'm not yet familiar with this API, thus I'd like to know in advance whether it's worth learning it.
Actually, I'd like to get all nodes on surrounding streets, in a given distance from a predefined point.
Thanks.
MapKit supports polygon drawing on the map. There is no isochrone function per say, it has to be built by you.
Check this out for details.
I know the post is a bit old but I want to suggest you the isochrone solution I've just developed: https://github.com/punkerpunker/isochrone. It might be interesting for you, works out of the box and solves task you've mentioned.
I am currently developing an iOS app using Objective-C and I came across with a requirement from my client that I am unsure and unaware if it can be made.
The app that I am working with is Map based using the geolocalization of the user at all times. To do so, as I am sure you all know, I am using the MapKit.framework that Apple gives us pre-built.
My doubt came when my client asked me if it’s possible to use the First Person Maps View instead of the traditional 2D Map. To make my question clear to you, what I was exactly asked if there is any chance to use the same view of the GPS navigation in the app (See picture below). Is there any way to do so? If so, could you give me some guides to achive that?
Any help would be appreciate it!
After some hours of research I've found a way to do so. The key property is initialized trough:
MKMapCamera *mapCamera = [MKMapCamera cameraLookingAtCenterCoordinate:ground fromEyeCoordinate:eye eyeAltitude:50];
Take a look at this tutorial if you are need of an explanation step by step:
http://nscookbook.com/2013/10/ios-programming-recipe-30-using-3d-mapping/
I need to find a way to get an list of shops/bars etc. around the actual position of the device.
I know how to get the position. I also know about the Google API Places. But is there an way to solve this without using third party libraries?
You can use the MKLocalSearch API's in MapKit, but you can only do a search for one type of building at a time.
More details can be found in the MapKit Programming Guide - Enabling Search
Otherwise you would have to gather and store the data yourself and query your own system.
I would like to ask if somebody can help me with a bit of code...I don't know how to create a route in my map in Swift.I just can draw a polyline between two annotations but it goes out of the roads.How can I connect two annotations on map?but connect them on road...all these is for a bus tour.can somebody help me showing me the code for this in Swift?
In order to trace a road like this, you will need data for the road geometry, but none of Apple's APIs provide this info. You will need to find your own source of geo data that both 1) provides point-by-point info for these routes as well as 2) matches the paths drawn in Apple Maps so that you trace lines up properly.
This is not a trivial problem. It's not likely to be done well using just Apple technology.
One way you could accomplish this is:
Use an alternate, open source of data such as OpenStreetMap.
Use a rendering library that draws such data for its basemap, such as Mapbox.
Combine the OSM data-based base map with individual route OSM-based data such as from the Mapbox Directions API.
The bottom line is that since Apple's maps data is closed, you can't guarantee that anything you draw on top of it is an exact matchup. You need rendering and routing data to be from the same source.
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.