Suppose that we have a fairly simple task - to show the location of objects (nodes, users) on the map. For example,
offices , or, say,
gift shops . Those. we have to get a page where the map with the location of all objects of a given type is displayed, and show the map on the page of each individual object. It will be about the 6th version of
Drupal , but in 5-ke everything is the same (to be honest, the screen at the end was shot exactly with Drupal 5). To accomplish this task,
I will use the following modules:
GMAP ,
Location ,
Views (
I also use
CCK &
Contemplate on my site, but they are so auxiliary in this task that we shouldn’t talk about them).

So, swing-turn. For GMAP to work properly, we’ll need
to get the Google Maps API Key from Google . The deal is free and fast. The resulting key is entered in the GMAP settings, then we set the settings for the card.

Then we will have to configure the Location module (it is the Location ... it was looking for a long time)

The main thing that should concern us here is the country and the daw "Use a Google Map to set latitude and longitude" Well, now let's allow the use of geolocation for our materials. So, I already have the type of material "Office", the entries in which I will be mapping:

Above, I indicated that for each entry there can be only one address, I set the city and country by default. It remains quite a bit: create a map where all the objects will be shown and display the map on the page of the object itself. Output the shared map via the View:

The main thing here - Style: Gmap. Well, the list of fields with the filter ... Now it remains to show the map on the page of the office itself. Here it is necessary to get into the code a little. So, in the template for this type of materials I added the following construction:
<?php print gmap_simple_map($node->locations[0]['latitude'], $node->locations[0]['longitude'], '', '<strong>'.$node->locations[0]['name'].'</strong><br/>'.$node->locations[0]['street'], 15, '650px', '400px', FALSE,''); ?>
<?php print gmap_simple_map($node->locations[0]['latitude'], $node->locations[0]['longitude'], '', '<strong>'.$node->locations[0]['name'].'</strong><br/>'.$node->locations[0]['street'], 15, '650px', '400px', FALSE,''); ?>
Ie I draw a map of 650x400 pixels, show a marker on it, in the description window I write the name of the node and the address. That is, in fact, everything ... Let's try it in action? Add a record and put down the location there:

Let's see what the map looks like on the object page:

This is the page with the list of objects. So far, there are only 2 of them, so not too impressive:

However, it is possible to show, say, the
list of gift shops in St. Petersburg or the
location of the lion statues in St. Petersburg :
