Google Map display in localhost but not in live server - google-maps

http://www.viethouserestaurant.at/
Please check above the site. Any one can help to solve my issue?
I have display google map at the last above the footer.
I can see the google map on my localhost but on live server i can not see.

Running it on a server requires an API key.
A potential issue could be that you didn't declare your website URL in the Google Maps API key page and only included localhost.
Find your API key in the console and add your websites URL

Related

Enable google maps api key in production environment

I made a flask app and deployed it to a linux server on Linode. It is running and some of my pages are working. For example, the contact page works. However, some of them have an inset google map. Upon loading one of these pages, my map is visible for a split second, then a big gray exclamation! and the map is blocked.
While testing the app using Flask's built in development server in my remote environment, all my functionality worked. When moving to a production environment, I used nginx and gunicorn. And I think I did it correctly. Judging that I do see the google maps working for just a second, it looks like this is not the issue.
Do I need to enable my google maps javascript api key for the production environment somehow?
When I have a look at your source code, I see
https://maps.googleapis.com/maps/api/js?key=None&callback=initMap
So, you did not add the API key, so it cannot work.
Please see https://developers.google.com/maps/documentation/javascript/get-api-key for how to get a key.

Google Maps API for both localhost & production server, as of April 2019

TLDR
My code works fine on my laptop when accessed as file://<path>/index.html, but neither on my laptop with an Apache server running when accessed as http://<path>/index.html, nor on my real (production) server. I see no errors on the console, but the map is just a grey rectangle.
[Update] I moved to LeafletJS shortly after asking this question, and recommend others to do so too.
It has been a few years since I coded any Google Maps applications.
It seems that, as of last year, it is now necessary to have an API key, by providing it with credit card details, and to provide it with each API call.
Unfortunately, there is a lot of of information about this, much/most of it out of date and/or contradictory.
Can anyone point to the canonical guide, preferably with screenshots, of how to configure this?
I wish to draw a map, and add some makers, which will require reverse geocoding, such that I provide a street address and convert it to lat/long in order to place the markers.
Sounds simple enough, but which of the many thousands of "helpful" site has gotten it right?
For instance, what seems to be the current Google help page speaks of
From the Navigation menu, select APIs & Services > Credentials.
On the Credentials page, click Create credentials > API key
But I can't even see that menu option :-(
[Update] If it helps any, the error message in the developer console said :
Geocoding Service: You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key
[Update] I am trying to access the API like this
<script src="maps.google.com/maps/api/…>
and
var url = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + comapnyLocation +'&key=XXXX';
$http.get(url)
[Update++] in the developer console, I see a bunch of errors along the lines of:
aliextension.com/wp-content/uploads/2017/08/JAR.png:1 GET https://aliextension.com/wp-content/uploads/2017/08/JAR.png net::ERR_CONNECTION_TIMED_OUT
I have no idea what aliextension is, nor does it appear in my code (maybe in some minified JS?)
Ok, it is something to do with AliExpress (Ali Baba). I removed it & the timeout messages go away, but I still have problems.
If I load the index.html into Chrome as a file://, then it works just fine. But, if I load it `as http://, where I have a Xampp Apache server running, the map box remains grey, although I see no error messages. The same thing happens on my real server :-(
This page should be your starting point:
https://developers.google.com/maps/documentation/javascript/tutorial
it helps you working with Google map javascript API.
To embedded a google map to your website read the overview page in the above link.
To add markers to your google map read this page:
https://developers.google.com/maps/documentation/javascript/adding-a-google-map
To do reverse geocoding read this page:
https://developers.google.com/maps/documentation/javascript/geocoding
That all i need to work with google map. I think you can do the same too.
The cause for this is quite likely an API key restriction.
In order to permit these host-names or IP addresses, you have to:
a) go to the credentials panel and select the according project, then click on "Api key".
b) there you can loosen the restrictions, for HTTP referrers (for web-sites)
... or for IP addresses (in case these are server-side requests).

Google Map Show blank Map

help me please...
for a very long time i have a problem.
i was made android application which implemnet google maps with eclipse. I have following a lot of tuorial from google. All of them failed. After I installed in my device, program just showing blank white map with only zoom control and sign google. I was put all of permission needed in my manifest, i have my apikey which i get from my SHA1. I got my SHA1 from windows - preference - android - build. I also tried to get my SHA1 from commandprompt and have the same result. Android google map v2 was switch on.
somebody, help me please.. whats wrong with my program..
I also had the same problem, in my case it was due to API KEY it was not correct. I regenerated key with SHA1 and problem solved.
This link has sample code you can download and check
You must get API key from Google Console by the link that provide into google_api.xml in android when create map activity in android studio.
so you copy API Key from google console and past into google_api.xml where YOURKEY HERE.After you must go to Google Console and enable key so it will work.
In my case it was an existing app that I cloned from GitHub.
What worked for me is to enable the SHA-1 of my signing certificate. Follow these short instructions.
Then I had the main developer add my SHA-1 fingerprint to the authorized packages for his relevant API Key here (in his login). Then it worked.

Google maps API v3 flash empty viewport

I'm using the google maps API v3 with flash and it works fine on one of my websites.
I transfered it to another website and changed the API key, but all I see is the default background color with no error message. Unfortunatly, I cannot access the flash source code.
Is there a way to debug the application or see some error messages without the source code?
Or maybe somebody has an idea of what is wrong?
Use Firebug Net monitor to see if all of the request are going through. That would be the first place that I would start. My guess is that there are HTTP Requests trying to get data from a domain that doesn't have a crossdomain policy allowing access from the new site you moved it to.
First of all maps V3 doesn't need a a key. I think you are combining parts of V2 (with key) and V3(which doesn't need key) so obviously there is something wrong in your code.

What site do you specify when applying for key to google maps?

I may be dim, but I really don't know what to answer when google asks me for a URL when asking for a key for google maps.
I mean, I'm on my laptop, with no internet dns entry developing the solution in visual studio, so what do i tell google? localhost? The domain name I know the site will end up on? my laptops name?
Use the key which will correspond to the name of the server in the URL. I've used both localhost and the name of the laptop on local network.
Change to a different key on the production server.
I have always set up the API key to represent the sites future URL. I have seen no issues with using the API key on localhost that was setup for domainname.com, but that may be related to the subset of the Google Map APIs that I utilize. I would use your site's final URL when you set up the key for Google Maps.