Simplemap Drupal Module

November
04
2009

simplemapSimplemap 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 :

  1. /* style all maps to 100px by 100px */
  2. div.mapcanvas {
  3.   width:300px;
  4.   height:300px;
  5. }
  6.  
  7. /* overwrite sizes for a specific map */
  8. #simplemap2 {
  9.   width:300px;
  10.   height:300px;
  11. }
  12.  
  13. /* set the marker content balloon styles for an info balloon on simplemap 2 */
  14. #simplemap2  .markercontent {
  15.   font-size: 8px;
  16. }
  17.  
  18. /* set map styles for all maps in column one */
  19. #column1 div.mapcanvas {
  20.   width:200px;
  21.   height:200px;
  22. }

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.

  1. ; The default marker for all blocks
  2. [default]
  3. image-path=images/markers/default-marker.png
  4. shadow-path=images/markers/default-marker-shadow.png
  5. iconanchor-x=32
  6. iconanchor-y=99
  7. infoanchor-x=5
  8. infoanchor-y=1
  9.  
  10. ; The default marker for the simplemap1 block
  11.  
  12. image-path=images/markers/map1-default-marker.png
  13. shadow-path=images/markers/map1-default-marker-shadow.png
  14.  
  15. ; The marker for the first marker in simplemap1 block
  16.  
  17. image-path=images/blog/balloonmarkera.png
  18. shadow-path=images/blog/balloonmarkerashadow.png
  19. iconanchor-x=69
  20. iconanchor-y=86
  21. infoanchor-x=69
  22. 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) :

  1. [ 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.

Julian

COMMENTS

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!

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,

Is it possible to hide the Google Logo ?

Great tut and module !!

For everyone having inline embed problems here are some hints:

You must enable simplemap in Input Formats and rearrange the order so simplemap is at the bottom. Double check when you are editing content that you have chosen simplemap as the input format.

The format of the embed must be:
[simplemap id='1' class='mapclass'] - must be single quotes and the map id is just the map number. Don't have a space between [ and simplemap (as shown in the example on this page)

The map ID number can be found by viewing the block version map and if you view source look for something like 1">

If you are using a WYSIWYG editor this will probably stop the embed from working as it converts quotes to their htmlentities, so edit using plain text.

Hope that helps

Stripped some of my code above. Should say:

if you view source look for something like
<div class="mapcanvas" id="simplemap1"> - the ID will be 1 (not simplemap1)

Thanks this mod is awesome. One minor feature request would be that the marker title balloons show up on hover instead of requiring a click. Can anyone suggest how I could do this?

Thanks

I have a problem, I positioned all the markers but sometimes they don't stay in that position. Why?

Awesome guide thanks this is just what I was looking for sadly their aren't many straight forward templates that I have come across. But this seems accessible enough, my new gyration drivers should make the experience much easier now too.

I have 2 markers too close and then it overlaps, how can I fix this?

This should work well on my site with my new Cloud Security features. These google map pointers are amazingly simple to understand, more websites really need to catch on to them.

Bosch Buzdolab? So?umutuyor? Bosch servisi nerde? En yak?n Bosch Bayisi? Bosch Servis olarak ?stanbul?un tüm semtlerine hizmet vermekteyiz.
Ar?zal?, bak?ma ihtiyac? olan bosch markal? cihazlar?n?z? Bosch Servisi olarak günümüzün son teknolojileri ile tamir ediyoruz.
Bosch Beyaz Eşya Al?rken Neye göre seçim yapmal?y?m?
Beyaz eşya al?rken, ihtiyaçlar?n?z? en üst seviyede karş?layacak şekilde seçim yapmal?s?n?z. Ürünle ilgili beklentilerinizi bayiye net olarak iletmelisiniz. Ürünün, reklam?nda veya tan?t?c? broşüründe belirtilen özellikleri taş?y?p taş?mad???n? kontrol etmelisiniz. Bosch Servisi yan?lt?c? ibareler içeren veya gerçe?i yans?tmayan ürünler ay?pl? mald?r.
Bosch Buzdolab? Çal?şm?yorsa ?
Buzdolab?n?z çal?şm?yorsa yapaca??n?z işlem bosch servisi ça??rmakt?r.Bize ulaşmak için http://boschservisin.net adl? internet sitemize girebilir veya 444 1 784 numaral? telefondan bize ulaş?p ar?za kayd? açt?rabilirsiniz.
Bosch Kombi Çal?şm?yorsa ?
Kombiniz çal?şm?yorsa yapman?z gereken 444 1 784 numaral? ça?r? merkezimizden bize ulaşmak veya boschservisin.net ?den ar?za kayd? oluşturmakt?r.

Firmam?z S.M. Mali Müşavirlik Bürosu; Meslekte uzun y?llara dayanan deneyimli kurucu kadrosu ve çal?şanlar? ile 14 y?ld?r Avc?lar?da faaliyetine devam etmektedir.

Devlet ad?na, belli bir ciroya ulaşm?ş firmalar?n hizmetini almakta zorunda oldu?u, o firman?n muhasebe ve mali kay?tlar?n? kontrol etme yetkisine sahip ve bu firmalardan belli bir ücret almay? hakeden şah?slara mali müşavir denir. Hizmetlerimiz hakk?nda daha detayl? bilgi almak için bizimle iletişime geçebilirsiniz.

istanbul franke servisi thanks post

I was asking in a previous post how to add certain things to the maps like balloons and other pointers. I see here how it's done and I truly appreciate the fact that you take the time to explain all these things so you can make it easier for us.
___________
Allie Patchell - email affiliate

Can you provide some more information on going about redirecting users after a successful logon from a custom access denied page as described in this post?
real soft

thank for pligun

Sitenizin içeri?i ve görsel tasar?m? gayet başar?l?

thank you

seo uyumlu tan?t?m yaz?s?

thank your login

thanks your for lisaning

thank you nice post. amazing write sites

We provide osteopathy, Chiropractic, acupuncture, massage and nutrition services in the North Ryde, Lane Cove, Macquarie Park and Ryde areas of Sydney, NSW.

Thanks for your work!
Had database problems with Gmap blocks....you saved me many ours with your alternative.

istanbul franke servisi thanks post Nike run free | Nike free run sale | Nike free shoes

Had database problems with Gmap blocks....you saved me many ours with your alternative.

Sabila Para Adelgazar

como bajar de peso

Useful information ..I am very happy to read this article..thanks for giving us this useful information. Fantastic walk-through. I appreciate this post.

A very nice informational blog.Keep on making such important blog post.Your work is really being appreciated by some one. web design company

Hi great module for beginners like me I would like to set my default marker as yellow pin for example, i dont get the simple.marker file. can you give me an example of the easiest way to set my default marker

Thanks so much

Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful :: iphone 5 cases news.

Wieso die günstige PKV so gefragt ist.
Eine Unfallversicherung abschliessen.
Wie man die Rechtsschutzversicherung Vergleich bewertet.

Einen Versicherungsvergleich machen.

Die Haftpflichtversicherung testen.
Den Privathaftpflichtversicherung Vergleich machen.
Den Rechtsschutzversicherung Test durchführen.

Eine Mastercard beantragen.
Den Privatkredit abschliessen.

Die Berufsunfähigkeitsversicherung testen.
Eine günstige BU abschliessen.

Auf Kredit-Rechner vergleichen.
Eine Wohn-gebäudeversicherung testen.
Eine Riester Rente im Test.

Einen Versicherungsvergleich ausführen.
Wie der versicherungsvergleich ausfällt.
Wieso Geld eine so grosse Rolle spielt.
Eine Zahnzusatzversicherung testen.

Hey! Would you mind if I share your blog with my twitter group? There's a lot of people that I think would really appreciate your content. Please let me know. Thank you

Here is my comment to show my appreciation to this post. It is just that one I was looking for and I can say I have found it. I have always tried to understand this Drupal module but here it is my only solution. how much is lasik eye sugery can now be mentioned so I inviting all to accept this.

As new comer, your advice give me something new.. wait for the other nice post... :)

Very fantastic post. I really enjoyed reading it. Thanks for sharing.

I am really not too familiar with this subject but I do like to visit blogs for layout ideas. You really expanded upon a subject that I usually don’t care much about and made it very exciting.
music production

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options