matthew moore
matthew moore

Reputation: 215

How can I add a Google Map with Drupal?

I have a page that works fine pulling users and locations from a Drupal database ..

http://www.wpcreations.net/gmaptest/map.html

This is a working version. I know Drupal has a module that does the job and I am using parts of it. But for some reason if I use the map include it fails. But I can make an HTML page that does the same thing and works. Is there a way to put all the code from my HTML page in the site? Or, how can I force the map/markers to appear? I tried to use an iframe and that did not work.

Sorry, I'm new to Drupal. I'm using version 6.19 and can't go higher. Thanks for your time.

Upvotes: 0

Views: 410

Answers (2)

Max
Max

Reputation: 6801

You need a combination of 3 modules that will help you solve your task:

  1. Location - enable: Location + User Locations
  2. Views - enable: Views + Views UI
  3. GMap Module - enable: GMap
  4. Keys - Optional

After you install the modules you have to configure them:

  • Gmap - at least enter the Google Maps API Key
  • Location - set the permissions and go to User settings and configure the new User locations options. After this users will be able to fill in fields regarding their location (City, Province, Street, Longitude&Latitude etc). You have many options here so for example you can provide a default country, you can make some fields mandatory, others optional etc.
  • Keys - is an optional module but it's good to have when you want to manage multiple Keys. Scenario: you have a test version and a live version of your site so you'll need two Google Maps API Keys. Using this module will spare you changing the keys all the time.

Now to demonstrate the concept:

  • add a new View -> View type: Users
  • add a page view
    • Style: Gmap
    • Enter the page path
    • Fields: whatever fields you enabled for the users on the step for setting up location step

Go to the page view and if everything work you should see your users on a map.

You can get creative and, just like a page view, build different blocks and place them in different places on your site. Advantages is that you can place them pretty much anywhere you want.

Upvotes: 2

Sibiraj PR
Sibiraj PR

Reputation: 1481

Use the drupal modules

http://drupal.org/project/gmaps

Upvotes: 0

Related Questions