How can I add the Google Maps API on my website?

I want to add the Google Maps API on my website, but did not find a good link. Please help me. Thanks

+4
source share
4 answers

First you need to register with google and get the MAPS api key:

http://code.google.com/apis/maps/signup.html

Then you need to embed some javascript in your pages / templates:

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=__your_key_here__" type="text/javascript"></script> 

Another bit for drawing the actual map:

 <script type="text/javascript"> //<![CDATA[ function createMarker(point,html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); return marker; } function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(51.16349933440274, 4.371164292063712 ), 6); var point = new GLatLng(51.16349933440274, 4.371164292063712); var marker = createMarker(point,'<div style="width:240px"> \ Place: <b>ANTWERPEN </b><br> \ </div>') map.addOverlay(marker); } } //]]> </script> 

This guide was helpful:

http://econym.org.uk/gmap

The map API documentation is very good:

http://code.google.com/apis/maps/documentation/javascript/

Please note that version 3 of the api maps has recently been released (it has many improvements for mobile browsers, so you may need to learn).

It could be a candidate to move to stackoverflow.com

+4
source

Google Maps provides a very good API, so you can display Google maps on your website. Most webmasters use Google maps to help customers find the location of their business (usually on their contact pages). Others create complete applications based on Google maps. It’s very easy to implement Google maps on any website. Read here

+1
source

V3 API no longer requires API key

I still could not find something that allows you to get an interface like "my cards", which you will get at https://www.google.com/maps/mm

0
source

You can simply generate the code to display your map at http://www.map-embed.com . Hope this helps.

0
source

Source: https://habr.com/ru/post/1311171/


All Articles