get link in google map info box - google-maps

how do get different link of "send to friend", "print map", and "get direction" link in the marker info box related to that marker.
Is there any API for that to get this type links.??
Thanks in advance.

There is nothing explicit in the Google Maps API that will show the maps.google.com InfoWindow , you will have to build that functionality into your own GInfoWindow. For the functionality you describe, you could do the following:
send to friend - Some server side code to email your site URl to a user specified email address?
print map - Link to a cut down page that displays a Google Static Maps image (for the equivalent location). The various browsers will do a better, more predictable job of printing an image than they will a Google Map DIV.
get direction - You can use the GDirections object to GeoCode to addresses and display the driving directions between those two points (on the map and with instructions).

Related

Different default viewports in Google Static Streetview API vs Google Maps Embed API

I'm looking for a way to get the default heading in the Google Maps Streetview Embed with the same accuracy/heading as the static Streetview.
For a project I'm using the Google Maps static Streetview API to create a snapshot/front facing view of an address. The way I do this is to first find the address LatLng with the Google GeoCode API, using the full address (streetname+house_number+house_number_addition+zipcode+city). With the latLng I then call the Static streetview API to fetch a snapshot of this location.
https://maps.googleapis.com/maps/api/streetview?size=900x600&location={$latLng}&key={$key}"
As you can see there is no heading param specified so the API determines the best possible heading based on the given LatLng, as specified in the API docs.
The result is spot on for 99% of the cases, in which the house is almost perfectly centered in the streetview snapshot.
The Google maps streetview embed has a very different result. The steps leading up to the creation of the embed URL are identical (find the latlng based on the full address, and use the LatLng as the location in the embedcode)
https://www.google.com/maps/embed/v1/streetview?key={$key}&location={$latLng}"
resulting in the iframe HTML
<iframe src='{https://www.google.com/maps/embed/v1/streetview?key={$key}&location={$latLng}"}' width='600' height='450' frameborder='0' style='border:0;' allowfullscreen='' aria-hidden='false' tabindex='0'></iframe>
In this case the heading or camera direction is in many (not all) cases almost facing opposite of the targeted house. Of course this can be adjusted using the heading param, but it's strange that both streetview API's differ so much in the chosen heading.
After some more digging I found the answer here. The solution is to first use the Directions API to navigate to the given location, which sets the heading facing the location. Then use the getPanoramaByLocation method of the StreetviewService to determine the correct heading.
So instead of constructing the embed code serverside, the best approach seems to create the Streetview in the frontend using the Google Maps API.

Places Autocomplete: Must I use a Google map if I Geocode the result with Apple?

Trying to implement a search feature for USA cities in my IOS app. My goal is to use Google's Autocomplete API while legally avoiding the use of a Google map.
So, if I use Places Autocomplete API to display a list of suggested cities as the user types do I have to use a Google map if I geocode the chosen autocomplete result through apple with CLGeocoder?
Google says you must use their data in their maps. However, if I geocode through Apple to retrieve the coordinates for display on a map, the map data isn't coming from Google. Is this legal?
I know Airbnb uses Googles places api but they use Apple maps.
According to Places API Policies:
If your application displays Google Places API Web Service data on a map, that map must be provided by Google.
If your application displays Google Places API Web Service data on a page or view that does not also display a Google Map, you must show a "Powered by Google" logo with that data. For example, if your application displays a list of places on one tab, and a Google Map with those places on another tab, the first tab must show the "Powered by Google" logo.
So you can use Places autocomplete without a Google map, but in this case the logo is required.
https://developers.google.com/places/web-service/policies

How to get the pin to show up on Google Maps URL

My web application constructs a URL to go to Google Maps based on the lat and long of a place. Works great, however, the pin does not show up on the map of the location. For example, if I have this URL: https://www.google.com/maps/#39.0522772,-94.3865605,17z
Is there a specific parameter I need to pass in order for Google to show the pin?
There is a list of query params here but it doesn't include showing a pin.
You can do this a couple of ways
Using preview
https://www.google.com/maps/preview?q=39.0522772,-94.3865605
Creating directions to and from the same place
https://www.google.com/maps/dir/39.0522772,-94.3865605/39.0522772,-94.3865605/#39.052269,-94.3885508,17z

Embeded google street view

Is it possible to have a google map embeded street view panorama of a given address in your page?
All the codes I have came across work with coordination, I'm looking for "address", since if you just use coordination you will have to set pov and all that,
Google seems to do that itself, look at the panorama picture here:
http://maps.google.ca/maps/place?hl=en&sugexp=kjrmc&cp=10&gs_id=z&xhr=t&biw=1680&bih=874&gs_upl=&bav=on.2,or.r_gc.r_pw.,cf.osb&um=1&ie=UTF-8&q=toyota+calgary&fb=1&gl=ca&hq=toyota&hnear=0x537170039f843fd5:0x266d3bb1b652b63a,Calgary,+AB&cid=16440335169618939517&ei=VpqYTpPsLbCrsALi0LnqBA&sa=X&oi=local_result&ct=map-marker-link&resnum=1&sqi=2&ved=0CF8QrwswAA
Thanks
Yes, using the Google Maps Javascript API V3. Take a look here: http://code.google.com/apis/maps/documentation/javascript/services.html#StreetView
You can also embed Street View on your page by just using Google Maps.
Search for the address on Google Maps.
Go to the Street View for the location.
Click the link button in the upper-right hand corner above the map.
Click the 'Customize and preview embedded map' link.
A new page will open up with some customization opens and the code to embed the map/image on your page.
Yes you can. All you need is a google decoder who will decode your address. Another way is to directly pass your address as a part of the url to google.
When using decoder, you will get the result in the form of a latitude longitude object which you can use to reset/set your map's marker
There is no way to accurately set the heading automatically and no way to set the pitch and fov (field of view) - BUT if you figure these out manually you can create a URL that fetches a static image with those settings from Google
Take a look at this tutorial on the Street View Image API

Google map marker disappears from map inserted via iframe

I have found location on google map and get custom iframe code with marked location. However marker always disappears from map after several days.
Here is our website about page: http://witcraft.ru/about. Location of our office was marked, but now the marker has disappeared.
Also we have same issue on other websites. How can I avoid this behavior?
Regards,
Alexey Zakharov.
Looks like the only way to ensure that marker won't disappear is to use company website name during the query.
So if you want to mark your company that has your-company.com domain you should search it on google maps and when grab embeded code. Keep in mind that your-comapany.com domain should be mentioned in company description that you send to Google Places service.