Styling the traffic in Xamarin.iOS - ios

Is there a way to change the style of the default traffic lines that appear when MKMapView.ShowsTraffic is set to true?
Thank you.

As you have probably already found out, the farthest you can go with traffic styling is exactly that one boolean variable showsTraffic that either shows it or not. MapKit is not really customizable apart from annotations and that's what you have to live with if you're not willing to use a 3rd party map provider. In my mind you have two choises:
Use a custom tile renderer with MKMapView
You can use the MKTileOverlay class coupled with the MKTileOverlayRenderer to fetch map tiles from a 3rd party service that supports tile fetching and customization, and then show those tiles instead of the default Apple map. One such service is Google Maps Tiles API but you need to request access to it from Google (it's not part of the normal Google Maps API) and it's paid.
If you're still willing to go that route, you can follow the Customize MapKitā€™s MKMapView with Google Maps styling wizard article on how to create your custom style and use it to request tiles from the Google Server. However, you should NOT use the Google Maps API address mentioned in the article, as circumventing the official Google API's and making requests straight to their servers is strictly not allowed and will get you banned and/or in trouble. Instead, you should use the official API I linked to above.
Use another map control altogether
I'm fully aware that the above is a lot work for just customizing the traffic lines, so if you're not willing to invest a lot of time and money, I'd suggest that you use another (customizable) map control instead of MkMapView. There are plenty of different options available, both free and paid.

Related

Using Bing Location API with 3rd party map

I'm trying to determine if it is allowed to use Bing Map's Location API and display and use the results in conjunction with a 3rd party map, such as OpenLayers.
I've dug through their license agreement and can't find clear direction one way or another.
The primary portion dealing with this seems to be section 3.2. General Restrictions.
(d) Use Content, including geocodes, other than via an authenticated call to the Services and/or in conjunction with a Bing Map.
(i) Use Content other than in combination with the Services and not separately.
I've focused on these two restrictions in particular. (d) implies to me that it is possible to use without Bing Map, as long as the Content is being access through the appropriate, authenticated Service. However, does (i) exclude independent use?
Google is much more plain text about this:
If your application displays Google Places API Web Service data on a map, that map must be provided by Google.
You can use any of the Bing Maps services with 3rd party map controls provide they use the Bing Maps map tiles. OpenLayers, Leaflet, and many other 3rd party map controls provide a way to use Bing Maps tiles already. Here is an example of using the Bing Maps tiles in OpenLayers: http://openlayers.org/en/latest/examples/bing-maps.html

Accessing Map Tiles of MKMapView

I'm currently developing an app that needs to display a map of where the user is currently located in the world. For technical reasons, I need to access every map tiles as an image (png/jpg) before going in the rendering pipeline.
I have tried 3rd party services like MapBox, MapQuest as they have a REST api that enables me to receive a png/jpg of a tile according to the requested location. The issue here is that MapBox isn't free, so I was wondering if there was a way to access the tiles that Apple provides in it's maps app. What service are they using under the hood? Would I be violating some terms of use by going with this approach.
Please note that using some integrated "do-it-all" UIMapView is not an option for me, I need the image directly.
Thanks
Google has a REST API. You can see the details here https://developers.google.com/maps/documentation/staticmaps/?csw=1. It does cost money if you go over the usage limits.
I manually download Map Tiles for my app, but I don't use MKMapKit. I have my own MapView and I am using a combination of MapBox, Thunderforest, CalTopo, OSM, and map tiles that I generated and host on AWS. All of them have a pretty easy map tile URL scheme, but you do have to pay for most of them.

Confused with Apple Map Vs Google Map

This might be a very stupid question for some people but I want to be make sure about this.
In iOS6 Apple has updated its Map application and added his own map. Now if I develop any native application and include map(MKMapView) into this so are their any changes which I should be aware of them?
Previously, I was using Google web service to fetch the latitude and longitude between two locations and draw direction. Does Apple provide its own web services for the same?
are their any changes which I should be aware of them?
MKMapView will still work fine, but the map it displays will look a little different. Also, if you limit your app to iOS versions that use only Apple's maps, you might not be subject to Google's terms and conditions. Read your agreements.
Does Apple provide its own web services for the same?
There's CLGeocoder. It's a class, not a web service, but that just makes it easier to use.
Using MKMapView framework didn't change just because the images are different. It should work fine.
Google's Terms Of Service say that you can't show their data on someone else's maps. So if your app is still getting data from a Google webservice you'll need to use the Google Map SDK that they have put out, not the usual MKMapView on iOS 6+.
If you are only using Google's webservice to turn a human readable address into lat/long then you can do that using CLGeocoder as Caleb suggested, but Google offer other services too.

How can i download individual map tiles from the Google Maps SDK (for iOS)?

I've been checking out the new Google Maps SDK for iOS that allows you to bypass Apple Maps for map related features in your app!
https://developers.google.com/maps/documentation/ios/intro
The SDK seems fairly easy to use, but i want to know:
If it is possible to use the SDK (are there API's) to download individual Map tiles?
If so, how?
Ive looked at the documentation given on their developer portal and it says the following:
https://developers.google.com/maps/documentation/ios/map
The key class when working with a Map object is the GMSMapView class. GMSMapView handles the following operations automatically:
Connecting to the Google Maps service.
Downloading map tiles.
Displaying tiles on the device screen.
Displaying various controls such as pan and zoom.
Responding to pan and zoom gestures by moving the map and zooming in or out.
Responding to two finger gestures by tilting the viewing angle of the map.
It seems like the downloading of the tiles happens automatically, or are there API's that allow manual access to the tiles?
If not, any workarounds would also help!
The documentation and header files do not indicate any way to download individual map tiles.
Even if you would find a workaround, you would not be allowed to use it. See clause 10.1.1 (a) in the Terms of Service:
No Access to Maps API(s) except through the Service. You must not access or use the Maps API(s) or any Content through any technology or means other than those provided in the Service, or through other explicitly authorized means Google may designate. For example, you must not access map tiles or imagery through interfaces or channels (including undocumented Google interfaces) other than the Maps API(s).

Google Places API Violation

I am using Google Places API to pull a list of resturants, and I am displaying them on map. However, since Apple has switched there map services over from Google in iOS 6.0, I am now in violation of Google's terms of use, which states that you must display Google data on a Google map.
"If your application displays Places API data on a map, that map must be provided by Google."
https://developers.google.com/places/policies#terms_of_use
I obviously need to change the map, because I am not going to release an application that is in violation. Any thoughts or suggestions on what to do? Should I go Google Maps with a web view? Does apple have some sort of Google Places API alternative?
Edit:
Using Google Maps through a web view is a hassle, i'd like to find an alternative to that, although it would technically work.
I decided to use Google Maps JavaScript API. Although, it is a little more difficult to deal with, mainly the JavaScript through Objective-C, it is a solution. The map is displayed through a web view, and I use JavaScript to interact with the map.
https://developers.google.com/maps/documentation/javascript/tutorial#api_key
I will wait to accept this answer, to see if anyone else has any thoughts. I just wanted to post this, in case it helps someone else.
Edit:
Google recently released a Maps SDK for iOS, this is the better solution now.
https://developers.google.com/maps/documentation/ios/
I would try to directly contact Google, explaining the situation, and ask them for written permission to use Apple's maps. This is more a legal question than programming. One would think that Google is aware that you can no longer display their maps using Apple's API and that, even regardless of the map, they would want you to use their places, as doing so generates advertising revenue for them.
Agree with #Owen here - you could get permission to leave your app unchanged until some possible future date when you might have to change it, or could you definitely go to the effort of changing it now and then possibly have to change it again in the future for some other reason.
If you could get a 100% guarantee that you could change it once and never have to change it again then I'd say do it now, but nothing's certain.

Resources