Google maps over https - google-maps

We are using Google Maps over https using a free maps API key. The Google Maps API FAQ says:
The Google Maps JavaScript API and Google Static Maps API can be
accessed over a secure (https) connection by Google Maps API Premier
customers. If the Google Maps APIs are used with a free Maps API key
on a secure site, the browser may warn the user about non-secure
objects on the screen.
My understanding of the above is that the API will work anyway, but users might get a security warning. For us, however, the map will not display at all, rendering the page completely unusable.
Does anybody know if Google is blocking use of the maps API over https with free maps API keys?

As of March 15th, 2011, anyone may use the API at https://maps-api-ssl.google.com/
http://googlegeodevelopers.blogspot.com/2011/03/maps-apis-over-ssl-now-available-to-all.html

From a quick look at the google maps premier site it seems like they probably are blocking it. One of the listed features is the "ability to provide secure maps over https"
http://code.google.com/apis/maps/documentation/premier/
Okay, here is some more specific info:
http://code.google.com/apis/maps/faq.html#ssl
It seems like you are probably getting a blank map because you are attempting to access with https a service that is only available to premiere members

You should probably use a protocol relative URL.
<script type="text/javascript" src="//maps.google.com/maps/api/js?sensor=false"></script>

After installing SSL certificate, I just had to do a simple change for everything to work.
From this:
<script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>
To this:
<script src="//maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>

You might be able to work around the problem by using OpenStreetMap instead. It doesn't present a super easy solution, because OpenStreetMap's main tile server does not support HTTPS connections, however there are various things you're allowed to do with OpenStreetMap which google would never allow.
Some more discussion of this on the OpenStreetMap forum: http://forum.openstreetmap.org/viewtopic.php?id=5546

no, google will let you display the map even if you are using free google API's over https login.
It definitely gives you a pop up box asking for a yes/no but your map will be displayed for sure.

Related

Google Maps, HTTP in China and Mixed Content Error

I'm displaying Google maps in China, the API there uses HTTP. However, my website is HTTPS.
Chrome, and any other mainstream browser throws a Mixed Content error.
How do I overcome this?
Was not able to find an easy solution with Google Maps.
However, using Gaode Maps ( 高德地图 ) helps was an alternative for Chinese based clients on sites HTTPS is needed.
They have an SDK with English instructions and similar functionality and coverage to Google Maps.
It is slower than Google Maps for non-China based users but is still okay to use.
You could detect the user's location and use Google Maps and Gaode Maps as needed.

The Google Maps API server rejected your request

I m working on an application which renders google maps on an image as below
<img alt="Google Maps (Scotland)" src="http://maps.google.com/staticmap?size=480x200&maptype=mobile\&markers=55.9368450758,-3.03604939504,reda|55.9454374538,-3.18124534297,redb&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx">
The map is not getting rendered and when I right click on the source of image and click the url, I get the following message
"The Google Maps API server rejected your request. This site or IP is not authorized to use this API key."
I have checked the API Access on https://code.google.com/apis/console the API key seems to be all correct. Just wondering how to fix the site and IP bit?
See below the settings in google API console
Make sure you have enabled "Static Maps API" service in addition to "Google Maps API".
Make sure you have enabled the Google Maps related Services ("Google Maps Embed API" and "Static Maps API") like bellow:
And then mark them:
In the new layout you find it here:
It works for me when I enable "Google Maps Embed API" and "Static Maps API"
Make sure you have a Browser key in the Simple API Access section, and make sure the Referers is set to Any referer allowed
Activate Google Map Key here: https://console.developers.google.com/apis/api/maps_embed_backend/overview?project=[your-project]
It will enable your map instantly.
I had the same issue. I used this instead of this and that resolved the issue. Some other api parameters didn't work on the second URL either (specifically marker styles), guessing the old API is deprecated
Would also recommend using https as opposed to http. This way your users wont get cert warnings if they view the page over SSL
Not only you need to enable google static API, but also you need to include your api_key in the link.
From june 2018 you have to configure a billing account to continue using Maps static API; google "donate" 200$/day of credit
Maps Static API Usage and Billing
add key in the url is not enough
As commented by Pointy, you need to use an API key with all referrers allowed in order to use Static Maps.
You can achieve that just by removing all the referrers from the list of authorized referrers. Or just create a new API key and use it without further configuration.
More info at the Documentation

Google maps on a self hosted website

I've a small self-hosted website hosted on my home server via no-ip.com, wonder if it's legit/possible to use Google maps on it and what would be the viable options if not?
What do you mean with "to use Google maps on it"?
If you just want to allow your users to see a map and navigate on it, it is possible. Google has published a SDK (Google Maps API) that allows other people to interrogate Google servers, collect data (maps), show maps to users and perform a few operations related to positioning and navigation. There is a web (javascript) toolkit for this here:
https://developers.google.com/maps/documentation/javascript/
Other info here:
https://developers.google.com/maps/
https://developers.google.com/maps/documentation/
If you want to host a clone of the Google Mpas service on your PC, then no, this is not possible (both for legal and technical reasons).
A well-known, largely appreciated alternative to Google Maps is openstreetmap:
http://openstreetmap.org/

Embedding Google Maps over SSL

I'm embedding a map on a page via https URLs but I'm still seeing resources loaded via http:// in the Net tab in Firefox. I've done some Googling and everything I'm finding is about the Google Maps API. Has anyone gotten this to work over SSL before?
http://googlegeodevelopers.blogspot.com/2011/03/maps-apis-over-ssl-now-available-to-all.html
Ismail is right - check out the thread on Options for Google Maps over SSL.
Personally I had to migrate my Google maps to Bing for the https connection api.
The Google map apis should now be available over https - but at least from my point of view there may be clashes with the licence (not-for-profit organisation but the site is access protected).
Have a look at Mapstraction if you want to swap map interfaces around to try them out.

Map controls for sites running https

A team I work with is currently in an unfortunate situation. They've spent a lot of time integrating the google map control on their site but they didn't discover that to run google maps on a https site you must license the control (and it isn't cheap) and the same goes for bing maps.
So my question is do you know of any cheaper/free map controls like google or bing maps?
OpenLayers
In version 3 of the API, HTTPS support is now free.
Why can't they put the google maps part on a non-secure page or frame? The google licence says that you must have it on a publicly accessible site to benefit from the free version of the licence, so even on a http site, you may still need to pay for the data.
All other mapping tools are dependant on the expensive map source data, so you'll not find any. The exception is OpenStreetMap which uses community-supplied map data.
MapQuest's API allows SSL usage through the free license.
I was looking into this and found this post - you can use Bing maps over ssl with no problems, and it seems to work fine.
For the danish users I found the following VisKort component on SoftwareBørsen. It looks like it is based on OpenStreetMap, but I'm not sure.