Open Google Maps place on iOS with Universal Link - ios

I'm using Universal Links to open a place in Google Maps since I don't really see another way.
I create a normal Google Maps links like this, which on web resolves to a place:
let urlString = String(format: "https://www.google.com/maps/place/?q=place_id:%#", annot.cafe.google_place_id)
Then I tap it on iOS and get Google Maps opened with the error that no such place could be found.
Should this work? Is there some other way to focus a specific place on iOS Google Maps?

Turns out this is possible using a search URL construction as specified here: https://developers.google.com/maps/documentation/urls/get-started#search-action
The constructed URL needs to have both the query with the lat/lon coordinates in it and a query_place_id with the place id.
It looks like this:
https://www.google.com/maps/search/?api=1&query=52.504875%2C13.394549&query_place_id=ChIJoaO7QRRRqEcRtBLLz6p4PS0
That creates the desired behaviour of the map going to the location and displaying details for the given place.

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.

Google Places iOS SDK: How to Get Point of Interest Based on Text Search

If you go to google.com and search "Attractions in London", in the result page on the first line you will see a list of Point of Interest (POI) with its name, photo, and description.
I want to get this list of POI on my iOS app, without having the user typing "Attractions in London"; I will pre-load this list as suggested places in London. I've read through the Google Places API for IOS here: https://developers.google.com/places/ios-api/start. But I could not find any sample to search by text.
The only way I found is by accessing the Google Place Web Service API here: https://developers.google.com/places/web-service/search and do the text search. Get the JSON result and map it to my custom google place object.
Does anybody has experience doing this using client-site API iOS SDK? Not sure if I missed anything in their guide, or it's not documented or Web Service API the only way..
Thanks in advance!

Displaying "my map" layers in Google maps for iOS SDK

Is there a way to display (and search in markers data) "my maps" layer in a GMSMapView in the Google maps SDK for iOS? Searched docs but couldn't find.
"my maps" are basically custom maps with additional layers you can create on top of a google map region, I want to use a public one that has tons of layers and markers already in place (I do not want recreate them programmatically).
basic example for "my maps" data:
https://www.google.com/maps/d/viewer?mid=zRF3RCwWPTMg.k8Zh-QyncJYc
thanks!
Unfortunately it looks like there is no API for accessing My Maps, see here:
Google maps API - get my custom map
However, it looks like it's possible to convert your My Map into KML, either a one-time download or a live link to the current map content, see here:
https://support.google.com/mymaps/answer/3109452?hl=en
(I found this via Add Google "My Maps" Layer to Google Maps Javascript API, although the UI to get the KML has since changed from that answer in 2009).
Once you have the KML you can't add it directly to your map, but you can parse it and then add each of the markers etc, see here:
How to load a KML file URL into Google Maps using iOS API?

Clickable Link to Custom Route from Google Maps web to iOS app

My first question here. I'm hoping I'm doing the tags and such correctly so the right folks might be able to see this. If this question should be placed in other area, please let me know.
I'm trying to create a link to a set of custom driving directions that, when clicked from the native iOS Mail app, will open the Google Maps iOS app and populate the custom directions.
I have a map which has driving directions from Point A to Point B, but I've significantly revised the route using the click and re-position functionality in Google Maps (web).
Using the share function from Google Maps (web) creates a link that does in fact retain the custom route, which can be seen when the link is clicked and it opens in Safari. I don't mind that it opens in Safari, since at this point it prompts you to open up these directions in the Google Maps app. But here's where it gets muddy.
When you click the "use the app" button from Safari, the custom route does not carry over to the app. You are shown default route choices based on Point A and B.
The Google Directions API section on Waypoints and using the 'via:' prefix seems like the best way around this, but I'm not sure how I'd turn that into something clickable from an email.
For reference, here is one of the maps I made with a custom route. Basically I want to have it go from Point A to B along one road. I had to make a handful of points along the route in order to keep the route on the same stretch of road.
Further complicating this is Google's attempt to reroute even this map, based on real-time traffic. I went back to this link after copying it here to find out there's an accident on this road right now and it's re-routing through side streets.
Any help would be much appreciated.
Well, you can open the google maps as it follow as it is documented in the documentation:
comgooglemaps://?saddr=Google,+1600+Amphitheatre+Parkway,+Mountain+View,+CA+94043&daddr=Google+Inc,+345+Spear+Street,+San+Francisco,+CA&center=37.422185,-122.083898&zoom=10
However, there is no mention on how you can add waypoints. And, indeed, you can not even do it in the Maps App. So there is basically nothing we can do...
BTW, here is a blog where included some work arounds, hope this helps a little.
here is what i do : long method, but it works.
open google my maps (instead of google maps) and make your custom route.
in options, export your route to KML/KMZ
at gps vizualizer com, convert your route to the format your app accepts.

Google Maps Native App - Map Links

I want to open the native google maps application on a mobile device from my mobile website. Currently I am using the URL http://maps.google.com/maps?q=The%20Diner,%2027%20Main%20Street,%20The%20Village%20#55.7665863,-4.1455545, which works for one location.
What I am looking to do is show multiple locations with a different coloured marker. Is this possible.
Well i found when you use the non-secure url and post a list of postcodes it works fine you can add more postcodes by adding another +to: ;
http://maps.google.com/maps?f=d&source=embed&saddr=LD7+1EN&daddr=CH1+3AE+to:AB12+3AX&
havent really tried to make it do different markers with different colors or anything, but i suggest looking at the url generated by your browser in google maps and ensuring its not a https:/ link and i think it should work.
Is it possible to use google static maps in place of what you have?
This page shows a static map example with multiple markers.

Resources