how to generate google map api key for website

Google map is one of the best option to indicate the places on the map, now a days people show the marker of their address on their web-site using google map. if you want to add a google map in your webpage then you need to generate google maps API key for your site, you need to get this key from google and you have to mention your domain name, which allows you to display google map in your webpage. please keep in mind that google API key is unique for each domain, it means you can not use same API key for sub domain as well.

If you have google account then you get this API kay, because google API key attach with your account. if you have account then login to your google account then you get google API key from below url

Google provide this service absolutely free, there is no limitation on map load(map previews). if you are working with the sub domains and you need google map on every sub domain then you need to create the Client ID for all your sub domain web applications.

redirect on other domain when you load your page

Recently i am working with the google map and its working fine but after some days its not load the google map and redirect me on the other domain. if you facing the same problem then i have a solution for this. if there is any form which is in your site where user can insert the data like comments form or review form, if user insert the comment and its direct approval then its make this issue. below is one line code which you need to find in you entire web-page.

<META http-equiv="refresh" content="0;URL=">

Here, URL is the the domain on which you are redirected. if you found any code like this then remove it and your problem resolved.

latlng not defined google maps

latlng not defined google maps


when you are working with the google maps and when the map is changed dynamically as we choose the city or places then you need to center the map with the latitude and longitude then you use below statement.

map.setCenter(new LatLng(parseFloat(runtimelatitude), parseFloat(runtimelongitude)),parseInt(runtimezoomlevel));

if you use above statement its give error LatLng not define then you need to use either below statement

map.setCenter(new google.maps.LatLng(runtimelatitude, runtimelongitude),runtimezoomlevel);

Or you can use this statement

map.setCenter(new google.maps.LatLng(parseFloat(runtimelatitude), parseFloat(runtimelongitude)),parseInt(runtimezoomlevel));

I hope this will resolve your problem.