Google earth / maps

How to place a map within a web

google maps on a webSuppose we want to place in a blog post, or on a page a Google maps window, with a specific area and a mark in the center with details. Additionally a search engine at the bottom.

The simplest way is by opening the map in Google Maps, and choosing the option "link the map in an embedded way" in which you can customize some parameters. This is API free and is done using the "iframe" form.


The other way is using the API, through a wizzard made for AJAX, which allows you to create the code giving few details:

1 Define parameters

google maps on a web

In this case, we must define the size in pixels of the window that we want to display, it is preferable to keep one that is within the maximum width of the blog post, such as 400px

Then you have to define if you want an approach at the city, street or block level.

You can specify the details expected in the brand, name, url and address.

By pressing the "preview center location" button you can see how the window would be displayed.

2. Enable API rights

The next thing is to provide the data of the web in which we expect to show the window. This is to authorize our API number for that website ... and therefore, make us responsible for any violation that we may be making of the Google terms.

google maps on a web

Normally, to acquire an API, you enter this website, and request one for a specific url, then request to enter your gmail account and you are assigned a number and an example code. If the gmail session is already open, the system associates the account.


3 Generate code

google maps on a web

Pressing the button "generate code" the necessary html is created to only insert it in the Blog. For this, the code option must be activated, paste it and it is ready, in case of pasting it on a different website, to which the API has been authorized, a message will appear disavowing it.

And ready, it should look good. Go to the Wizzard

Because it is an AJAX-based API, some of the script created does not work very well in some content managers, such as Wordpress MU, where there is control over functionalities, but in general it should run well.

Golgi Alvarez

Writer, researcher, specialist in Land Management Models. He has participated in the conceptualization and implementation of models such as: National Property Administration System SINAP in Honduras, Management Model of Joint Municipalities in Honduras, Integrated Cadastre-Registry Management Model in Nicaragua, Territory Administration System SAT in Colombia . Editor of the Geofumadas knowledge blog since 2007 and creator of the AulaGEO Academy that includes more than 100 courses on GIS - CAD - BIM - Digital Twins topics.

Related Articles

Leave a comment

Your email address will not be published. Required fields are marked with *

Back to top button