I want to include a simple Google map on each node that represents a business. However, I'm feeling a little overwhelmed with all the modules that seem to be related to maps, such as:

Address field for CCK
cck_map
geomap
GMap Module
GMap Addons
Google Client Geocoder
location (API, module)
Map api
Map module

I suppose I could also manually embed a Google map in the nodes content area. So how can I create a map so that I can have:

ABC Company, Inc.
123 Main St.
SomeCity, FL 12345

 ----------------------
|                     |
|                     |
|  <Google map here>  |
|                     |
|                     |
|                     |
 ----------------------

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

Comments

ronan’s picture

The two modules I've used together are Location (to store the address) and gmap, (to build the map).

I usually just embed the gmap code right in my node-xxx.tpl.php file with some code a little like this:

      $thismap = gmap_parse_macro('[gmap zoom=15|width=400px|height=200px|id=business_map|control=Small|type=Map|markermode=0]');
      $thismap['markers'] = array();
      $thismap = gmap_location_node_map( $node, $thismap, true );
      if( $thismap['markers'] ) {
        print theme('gmap',array('#settings'=>$thismap));
      }

That should be all you need to create the layout your looking for (c.f. http://www.greenguardian.com/amazon-environmental-inc or http://localhost/bloomingdale/business/business-directory/abashiri-japan...)

------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/

userofdrupal’s picture

Thanks! Your greenguardian example is the type of thing that I would want to do. The localhost site will be more difficult for me to view ;)

I will look into the gmap module.

ronan’s picture

The localhost site will be more difficult for me to view ;)

Ha ha... what a moron. This one might work better:

http://www.villageofbloomingdale.org/business/business-directory/abashir...

------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/

mat.’s picture

I cannot find function "gmap_location_node_map" in gmap module for Drupal 5.
Better function for this is gmap_simple_map..

gmap_simple_map($latitude, $longitude, $markername = '', $info = '', $zoom = 'auto', $width = 'default', $height = 'default', $autoshow = FALSE, $map = array())

its using is for example (in node-xxx.tpl.php):

print gmap_simple_map(30, 30, ...);
ronan’s picture

Yeah, that function seems to have been removed from the module in a recent update. That was a fun discovery.

R
------------------------------------
Ronan - Gorton Studios - http://www.gortonstudios.com/

------------------------------------
Ronan
Founder - NodeSquirrel - https://www.nodesquirrel.com/
Agency Tools Lead - Pantheon - https://www.pantheon.io/

userofdrupal’s picture

I'm still learning about Gmap and theming. There is something about Drupal which makes it conceptually hard to understand, I don't know if it's lack of good documentation or the design of the system itself, or just the fact that cms's are generally complicated. I have created a custom content type using CCK and added location to this type. Now with custom theming I've created a node-mytype.tpl.php file that allows me to display the map and location information the way I want it.

I just found this link about putting a map on nodes, which is helpful I think: http://drupal.org/node/242014