BLOG
Simplemap Drupal Module
Simplemap is a Drupal module which allows the addition of simple static map blocks (via the block administration menu) without the overhead of setting up gmap module although it is designed to work in conjuction with gmap if it finds it installed. I find more sites I create require only a very simple map with one marker. It also allows themers to set images all or individual markers within the theme folder.
This is a example of an embedded simplemap with a marker theme file :
Setting up Simple map
First of all you need to download and install the simple map module. You can download the latest version from http://drupal.org/project/simplemap
Extract the module to your modules folder and install the module via Administer -> Site Building -> Modules.
Before you use Simplemap you'll need to set the google maps api key. You can get a key by going to the Google maps API sign up page
Agree to googles terms and put your website URL and click 'Generate API Key'. You will be given your key which you can cut and paste into the the simplemap settings page - Administer -> Site configuration -> Simplemap. Click 'Save Configuration' and you're ready to start adding maps.

If you already have the drupal GMAP module installed and configured you can skip this step - simplemap will use your GMAP key.
Adding a map block
Now to add your map go to the Blocks Adminstration page (admin/build/block). You should see the add the map block tab at the top of the screen.

Click this and you will be presented with the map configuration screen. This looks like a normal block configuration screen with an extra map section :

Most of the settings on this page should be pretty straightforward to anyone who has used drupal blocks before. Single clicking on the map will add a marker. You can fill in the content and title for the marker from the content balloon (Simple map will only display the content you fill in - if you supply no information the marker will have no information window) :

You can see the marker list below. From here you can edit the markers and remove them. You can also do the same by clicking on the marker. You willl also see the marker id's which will become useful if you wish to theme your marker. Clcik the marker name to center the map on a marker.

After adding all your markers you can position your map and zoom it appropriately. You can also set how the map will be viewed. Satellite, Normal or Hybrid. You can remove options via the advanced settings.
Now you are happy with your map click save block. You will be returned to the block admin screen where you can drag your blog into the appropriate region.
Theming your map and markers
You can theme your markers within your theme using your style sheet and an optional marker configuration file - 'simplemap.markers' (There is an example in the simplemap module folder - examples/). This involves writing a short configuration file saying the images you wish to use for each marker and where the anchor points are. Further instructions are available in the Simplemap help pages. You can style the map size / position using normal css rules - all maps have the classes 'mapcanvas' and the id simplemap with an id suffix (you can see it by viewing page source or using firebug). Embedded maps have an additional 'embed' suffix :
- /* style all maps to 100px by 100px */
- div.mapcanvas {
- width:300px;
- height:300px;
- }
- /* overwrite sizes for a specific map */
- #simplemap2 {
- width:300px;
- height:300px;
- }
- /* set the marker content balloon styles for an info balloon on simplemap 2 */
- #simplemap2 .markercontent {
- font-size: 8px;
- }
- /* set map styles for all maps in column one */
- #column1 div.mapcanvas {
- width:200px;
- height:200px;
- }
Here is an example simplemap.markers file which lives in the root of the active theme folder. In here you can set the default marker for all maps, defaults for an individual map or pin-point an exact marker.
- ; The default marker for all blocks
- [default]
- image-path=images/markers/default-marker.png
- shadow-path=images/markers/default-marker-shadow.png
- iconanchor-x=32
- iconanchor-y=99
- infoanchor-x=5
- infoanchor-y=1
- ; The default marker for the simplemap1 block
- image-path=images/markers/map1-default-marker.png
- shadow-path=images/markers/map1-default-marker-shadow.png
- ; The marker for the first marker in simplemap1 block
- image-path=images/blog/balloonmarkera.png
- shadow-path=images/blog/balloonmarkerashadow.png
- iconanchor-x=69
- iconanchor-y=86
- infoanchor-x=69
- infoanchor-y=86
There are a few values you can set for each icon - image-path, image-width, image-height, shadow-path, shadow-width, shadow-height, icon-anchor-x, icon-anchor-y, info-anchor-x, info-anchor-y. All of these are optional. They are explained in more detail in the sample marker file.
Embedding your map
Simplemap also includes a filter to allow you to embed maps within content. To embed a map you must first enable the simplemap filter for the input format you wish to use in the input format configuration page (Administration -> Site configuration -> Input Formats ). Choose the format you wish to allow embedded maps and click the simplemap setting. You should make sure non of the other input filters remove the map content by using the rearrange tab within the input format configuration page. If your map isn't appearing move the simplemap input filter further down the list.
Once your filters are set up you can embed any simplemap in your content using the following notation (replacing MAPID with the id of your map) :
- [ simplemap id='MAPID' class='YOUR_CSS_CLASSES' ]
The class parameter is optional and you may add a space separated list of classes for your map (e.g. class='class1 class2').
Happy mapping.




Wonderful!!
I've been wrassling all evening with gmaps and then found this module in my search for help. It took me 2 minutes to do what I needed to.
Thanks!
This is brilliant!! Thanks Julian
sdfg sdfg sdf sdfgggggggggggggggsdf sdfg dfgsdfg sdfg sdfg
Great work, thanks, that will save a lot of time with the contact pages.
However I have difficulties getting the embedded token to work. Where can i find the MAPID for instance?
Should the tokenfilter be installed as well to have the token translated into a map? (As my token does not generate a map in a node).
kind regards,
Simoneau says, “Being a Daniel haber Webster Scholar alışveriş gave me confidence in my ability to practice law. More importantly, my employers knew because I was a Webster Scholar, pet shop I could handle a Supreme Court appeal.” As a Daniel Webster Scholar, giyim he was evaluated each semester by a New Hampshire Bar bilgisayar Examiner, counseled clients under iskenderun supervision, appeared before judges, and developed his skills and judgment in clinical settings. oto aksesuar The program is unique in the nation.
Is it possible to hide the Google Logo ?
Great tut and module !!
tee times
teetimes
teetime
tee time
golf tee times
discount tee times
online tee times
golf reservations
http://discount-tee-times.blogspot.com/2010/02/playing-golf-at-tee-times...
http://online-tee-times.tumblr.com/post/425918583/awesome-tee-times
http://teetime.putblog.com/2010/03/04/golf—a-game-of-discipline/
http://golfteetimes.9co.in/good-times-are-tee-times/
Post new comment