Walking, bicycle and public transport directions with time required in each mode , iPhone - iphone

I am using following url to get driving directions between two locations.
NSString* apiUrlStr = [NSString stringWithFormat:#"http://maps.google.com/maps?output=dragdir&saddr=%#&daddr=%#", saddr, daddr];
What changes need to be done in above query to get directions for bicycle, walking or public transport and corresponding distance, time required between two places?
Thanks in advance for any help.

You must use the "dirflg=?" parameter, where "?" can be:
dirflg Route type.
dirflg=h Switches on "Avoid Highways" route finding mode.
dirflg=t Switches on "Avoid Tolls" route finding mode.
dirflg=r Switches on "Public Transit" - only works in some areas. Can also set date and time info described below.
dirflg=w Switches to walking directions - still in beta.
dirflg=b Switches to biking directions - only works in some areas and still in beta.
There are many other params available, read the Google Maps Parameters doc, but of course not all of them are supported by the Maps native API (which is updated at every iOS release). Is up to you to test them as the official Apple doc is not always up to date with all features.

Related

Maneuver issues in Turn By Turn Navigation with HERE maps in Flutter

Thanks in advance.
We have to use HERE map's Turn by turn navigation feature in one of our Flutter application, we have added billing in the developer account and have created the necessary keys.
When we try HERE map examples they have provided, we get everything except maneuver instructions that shows the user when to turn right/left/go straight for some distance etc.
I'm new to this and I have no idea how to get this, we never get events on the listener and it only shows updating there, am I missing something ?
this is how it looks right now, Updating...
I think we should be getting the progress here, but we are not getting it here...
_visualNavigator.routeProgressListener = Navigation.RouteProgressListener((routeProgress) { }
Please look into the provided example app. It shows here how to get the maneuver actions.
Your screenshot shows a different app, so make sure everything works with the example app, at first. The app offers to run a simulation mode. This should work. If you run the example app with real GPS updates, you may need to go outside and move to get location updates. This should also work.
If this still does not work, it could either mean that your device has an issue with getting GPS locations. Some iPads, for example, lack support. Or that you have disabled getting location updates. You can cross-check this when trying the positioning_app example from the same repository that shows how to get location updates.
A last point may be to clarify what events you get and what you miss: There are multiple event listeners providing real-time information during guidance - if you have only an issue with maneuvers, then most likely you can solve your issue by following strictly the code of the example app.
Note that previous HERE SDK versions, prior to HERE SDK 4.13.0, only provided empty maneuver instruction texts during guidance when they have been taken from the route instance. Make sure to take this information from the VisualNavigator instead.

List of default SystemSoundID

I'm trying to implement AudioServicesPlaySystemSound(SystemSoundID(****)) therefor I need a list of existing IDs for Apples SystemSounds. Searching through various posts I found this on GitHub. I couldn't find a fitting sound in this list for my purpose. Since this repository wasn't updated since 2013 I'm not sure if its up to date. I would like to know if there is a list of SystemSounds which is more up to date.
First of all, the list you have found is not published by Apple.
I do not know if the author researched by themself or just collected them, but that sort of action is considered as a reverse engineering which is inhibited in developer agreement.
I couldn't find a fitting sound in this list for my purpose.
You may need to find a sound resource instead of SystemSoundID, and register it and create a SystemSoundID for it using AudioServicesCreateSystemSoundID.
I would like to know if there is a list of SystemSounds which is more up to date.
The latest list of public SystemSoundID is here:
Alert Sound Identifiers
Constants
kSystemSoundID_Vibrate
On the iPhone, use this constant with the
AudioServicesPlayAlertSound
function to invoke a brief vibration. On the iPod touch, does nothing.
kSystemSoundID_UserPreferredAlert
On the desktop, use this constant with the
AudioServicesPlayAlertSound
function to play the alert specified in the Sound preference pane.
kSystemSoundID_FlashScreen
On the desktop, use this constant with the
AudioServicesPlayAlertSound
function to display a flash of light on the screen.
kUserPreferredAlert
Deprecated. Use kSystemSoundID_UserPreferredAlert instead.
(Some of them are for macOS only.)
Using other SystemSoundIDs, can be considered as using private API.
Some comments from Apple developers in Apple's devforums:
Does this count as a private API?
It would not be appropriate to use undocumented arbitrary values in APIs, so I would recommend you not do that in your submission.
Haptic feedback for force touch?
For a fixed SystemSoundID value to be considered API, it must have a symbolic constant in the headers. Passing in other fixed values is not OK.

Google Static Map path starting from North America although that location is not given in the URL

I have to get a static map with three markers and a path between the markers, I have done this so far,
URL : http://maps.googleapis.com/maps/api/staticmap?maptype=terrain&scale=2&center=-0,0&size=600x600&zoom=1&markers=color:red%7Clabel:A%7C28.37,77.13&markers=color:green%7Clabel:B%7C46.227638,2.213749&markers=color:black%7Clabel:C%7C-40.900557,174.885971&path=color:blue%7Cweight=3%7C20.593684,78.96288%7C46.227638,2.213749%7C-40.900557,174.885971
the path keeps starting from North America although I have not provided it's coordinates anywhere in the URL. Why does this happen and how to rectify this ?
I'm not 100% sure why it's not working for you, but I rearranged the arguments and it seems to work great for me:
http://maps.googleapis.com/maps/api/staticmap?size=600x600&center=0,0&maptype=terrain&scale=2&markers=color:red|label:A|28.37,77.13&markers=color:green|label:B|46.227638,2.213749&markers=color:black|label:C|-40.900557,174.885971&path=color:blue|weight:3|28.37,77.13|46.227638,2.213749|-40.900557,174.885971
You'll have to encode the | character if you're using it in a web app or something that doesn't handle encoding, otherwise a browser(Chrome works for me) should open this just fine.
Hope this works out for you!

iPhone link to map directions using string "current location" not lat and lng for saddr

I know there are numerous questions about how to construct a sharedApplication link to the maps app specifying the start and end address with coordinates. I've got that working no problem.
Has anyone found a way to link with a source address generically specified as "current location".
I ask because the scenario I'm working on having Core Location or a UIMapView would only be necessary in order to determine the user location prior to handing off to the map app where the user locating would seem to just happen again.
I've tried throwing UTF8'd "Current Location" and "[Current Location]" into the saddr parameter which amusingly starts from Current Montana. I've also tried simply excluding the saddr param.
I know this is often tread territory but this particular situation wasn't covered by anything I found searching here or on mapki. Before I add the core location code I just wanted to make sure there wasn't a more limited way to tackle this.
Thanks
This post is quite old, but recently I had to face a similar issue and I developed a solution.
Using "Current Location" (properly escaped) as source address works perfectly.
The downside is that "Current Location" is valid for English language only. If your iPhone is set to use another language, you need to know the exact translation that Apple chose for that particular language.
I wrote a class that can provide the exact translation for "Current Location" in any supported language. You can read my blog post about this.
Hope this helps.

Geospatial library for the iPhone

I'm thinking about creating a location-aware iPhone app that could work offline by coming packaged with a list of points of interest (POIs). The app would read the user's current location from CoreLocation and produce a list of the POIs in order of proximity to the user's current location.
I need two basic geospatial functions to get this application off the ground. The first is a function that tests if a point (the user's current location) lies within certain geospatial boundaries. The second is a function that can give me the distance between two lat/lon points. I would use the second function to sort the list of POIs by proximity to the user's current location.
I understand that this problem area is well traveled and there are open-source options. The leading candidate (that I know of) is the GEOS C++ library. The way I imagine I would use this is by compiling GEOS as a static library (and linking as a project dependency, as you do to include the three20 library.)
My question is:
What is the best way to get the two necessary functions into my application.
If the best answer to question 1 is compiling GEOS as a static library and linking it to my project, could anyone who has done this before offer some pointers? I'm a novice at compilation, static library building, etc. I would love to see some example code or tutorials on how to get GEOS compiled and included in a project with a trivial example usage.
Ok, it took me some time but now I think that I'm properly able to build the static libs or GEOS for iPhone (x86 and ARM for both the simulator and the real device) : libgeos.a and libgeos_c.a : the implementation and its api.
You can get the binaires there (for GEOS version 3.1.1, this is not the very last one) :
http://bit.ly/aTKsI6
(there are some other binaries there, the rest is for spatialite)
The job has been mostly achieved by understanding the way cross compilation is done via .sh scripts. This blog is a must see for that : http://robertcarlsen.net/2009/07/15/cross-compiling-for-iphone-dev-884
For distance between points, see CLLocation's getDistanceFrom: method.
I'm not sure what you mean by geospatial boundaries, but if you mean you have a rectangle defining a location, you can convert it to a CGRect, offset the latitude and longitude of all of your points by 90 and 180 respectively to make sure you don't have negative numbers, convert your CLLocation objects to CGPoints, then use CGRectContainsPoint to figure out if your location is within that rectangle.
All of the described functions are part of the standard iPhone SDK.