I have taken over the development of the GoogleMap Module created by bjornarneson. We are in the process of updating CVS but I wanted to announce some changes and updates to the module:

Core Functionality
- Multiple maps: each map is now a node
- Multiple RSS feeds: imports any number of local RSS feeds
- Custom icons: Specify a custom for each feed
- Lines with custom color (per feed level)
- IE compatibility (I hope, see the Lines nodeAPI below for caveats)

See an example of this: http://island94.org/node/15

You can get an advance copy here (or wait for the CVS, there still may be a few bugs to squash): http://drupal.org/files/issues/googlemap-2005-12-1-1624.tar

Added Functionality
NodeAPI for Lines: allows lines to be drawn at a node level (no easy way to create the line...yet, I'm looking at incorporating some of the functionality of GMap Filter module). Lines are then injected into the RSS feed. I use the tag "line" but I am not sure if this will create a namespace collision anywhere (this may break IE).

Additionally included
- Fullfeed.module: Because Drupal 4.6 caps feeds at 15 items, this module creates entire feeds of content. Code is ripped from taxonomy.module, so for a feed of term 1: /fullfeed/taxonomy/term/1/0/feed. I understand this can also be useful for getting your site indexed.
- Custom icons: I included a couple custom icons for you to fool around with (I like the photo one). I need to make a photoshop template to make it easier to create them.

Comments

green monkey’s picture

Wow and thanks .. you've been busy.

I'll download now -- I have fresh site to test it on. Drupal 4.6.3

bensheldon’s picture

I forgot to mention that this module is for the Drupal 4.6 branch. I have tested it on on 4.6.3 . I will update either when 4.7 goes stable or when I start using 4.7 .

KimaJako’s picture

Any experience to use this module for drupal 4.7.2 ?

Thanks in advance,
-----
www.PersiaData.com

potential’s picture

I'm glad to see there is progress being made on the google map integration because there is so much potential. Thank you for developing it further.

At some point I want to learn how to modify this module to have the following capabilities (currently, I don't have strong php knowledge):

The ability to display the location of the user (location pulled from profile). In addition, it would be cool to overlay the map with dots on the location of their buddies (clicking the dot could pop up their picture and a link to their profile). I also think it would be cool to have a 3rd overlay that displays the locations of the visitors to that page (based off IP address).

Thoughts?

- Dan

bensheldon’s picture

My coworker is actually building something to map users as I write this for his high school reunion website. When he puts some spit and polish on it, I'll try to make sure you know.

The only problem with this at the moment is two people living at the same address. At the moment only one person shows up (because the second person is hidden behind their icon).

At the moment my only idea is to give things a tiny random wiggle to hopefully allow the overlays to peek through and be clickable. Any ideas would be appreciated.

geodaniel’s picture

A little randomisation goes a long way, but obviously introduces an element of imprecision which can cause problems if people don't understand what's happening.

Perhaps pick out people (or any other kind of object) who have the same co-ordinates and create a cluster of people who all show within a single spot? When things are being geocoded using zipcodes or any other aggregated data, there is a great thance that there is going to be a number of people on the same spot.

Harmen’s picture

Just show one icon and on mouse over list all the names of the people at that location.

pbull’s picture

Nice work Ben...

I've figured out how I can put this code to use in the near future too. Thanks.

-pete.

wellsy’s picture

This module looks like it is becoming very useful.

Keep up the great work. I will install it on my test site when I have the time and report back any issues.

Would it be possible to somehow use the results of this type of implementation

With results like <marker lat="-27.371767300523032" lng="146.953125" message="your message here">

For them to be included in the rss feeds?
How could this information be input to the rss feed?

wellsy

orchidsonline.com.au

bensheldon’s picture

That is definitely a neat tool. I've been looking at the gmap filter module's geocoding tool as well for ideas.

For the vision of the googlemap module, I am wary of using a tag-like object like your example: <marker lat="-27.371767300523032" lng="146.953125" message="your message here">.

In terms of injecting it into an RSS feed, I would need to do some experimenting but at the moment I am reluctant to do so (I would ask the developer of the gmap filter_module) for the following reason:

I would like to keep the googlemap module as a means for organizing and visualizing already existing nodes (like a taxonomy tree or tag cloud) rather than as on object to be placed in a node (like an image or the gmap_filter.module). For this reason (and simplicity at the moment), tying into location.module produces a "one node, one point approach" and seperates the map itself from the contents it represents.

In this manner, a possible workflow using the googlemaps module for your orchid site is this:
1. Define a seperate Vocabulary called "Map" with individual terms for each type of Orchid (i.e. Green Orchid, White Orchid, etc.).

2. For each place you find a Green orchid, create a node with information specific to that location, e.g. Pictures of the Green Orchid in Northern Siberia, and, using location module, give coordinates to that node. Then categorize the node with the taxonomic term "Green Orchid" in the vocabulary "Map"

3. Create a GoogleMap Node called "Green Orchids", and import the feed from taxonomy term Mapping->Green Orchid (eg. taxonomy/term/7/0/feed). In the body of this GoogleMap node add general information about the Green Orchid.

4. Now, you have a map along with general information about the Green Orchid, and when users click on a marker on the map, it will take them to information specific to that locaton.

Other things you can do:

5. Once you have several different types of Orchids organized in this fashion, define a seperate mapping vocabulary (or subterm if you have this enabled) called "Map - Location" and add terms of general locations ("Siberia", "Europe" etc.) Now go back through your orchid nodes (the location specific, not googlemap) and assign these to a term in the Map-Location vocab.

6. Once you have done this, Create a new googlemap called "Siberian Orchids" and import feeds in the form of taxonomy/term/7+13/0/feed (where 7 is the term "Green Orchid" and 13 is the term "Siberia") do this for the White orchid (if the White Orchid is term 8 it would be 8+13) and your other orchid types as well (multiple feeds in one map).

7. Make a custom icon with a little picture of a green orchid and a white orchid and others and assign them to their associate feeds.

8. Center and zoom the map on Siberia.

9. Now you have a map that overlays all of the different types of orchids that grow in Siberia, and where specifically in Siberia they grow.

This workflow also allows you to have random visitors submit new content and avoid them from mucking up your map. Just create a flexinode with the fields you want, register it with the Taxonomy vocabularies and location.module and allow vistors to create it. Voila, now you have a dynamic map that you don't need to micromanage and visitors have a simple way to interface with it.

I hope this helps you visualize some of the neat things you can do with this module, and also why I think it's important (in this case) to keep the googlemap as an organizer rather than an object.

Oh, and I don't really think Orchids grow in Siberia (do they? I need to look on your site), but I've been mapping fallout shelters and somehow I can only think of Russian placenames at the moment.

wellsy’s picture

well I found (to my surprise) that there are actually some Siberian orchids see here LOL

Must get some listed on my site!

This module looks better all the time. Still looking at the workflow suggestions above at present.

wellsy

orchidsonline.com.au

bensheldon’s picture

I don't think I documented it but:

googlemap.module pulls its marker info window (what pops up when you click on a marker) from the node teaser (which is injected in the RSS feed). To help format this (window formatting is horrible at the moment), you can use

<!--mapstart--> Info Window Text <!--mapend-->

in the teaser to determine what does or does not go into the info window.

This helps format nodes both in the map and your regular page view.

For example, I like having pictures in my marker window, but there isn't room in there for any extra text. On the other hand, when people are seeing a page list of my nodes, I like to have some text as well in the Teaser explaning the picture (and I have the extra room for it). This helps you format it.

Be aware that these tags only work in the teaser, so if you want to be extra safe use the <!--break--> command as well (so put the <!--mapstart--><!--mapend--> before the <!--break-->)

wellsy’s picture

for your detailed reply!

Obviously you spent quite some time looking into my needs. Thanks for that!

I have been on 12 hr night shift and just woke up so I will digest all you have said and see what I can make of all of that.

My first impression is that you probably are missing the point a little on what I really would like to be able to achieve in some areas but have set me thinking about other possibilities as well.

I really want to enable a site where the community will enter the information....if they are keen and willing. So that leaves me (and a few other admins) free to simply check the information they submit is valid and enable it to be displayed on the site.

Anyway, as mentioned I will digest further and get back to you.

wellsy

orchidsonline.com.au

wellsy’s picture

it works fine to display a map. Very cool! Also easy to setup the map how you want.

Now how do I get location information into an rss feed?

wellsy

orchidsonline.com.au

bensheldon’s picture

The Location Module does all of the geocoding, raw lat/long input and injects the data into the RSS feed. This is then parsed and displayed by the googlemap module.

Lines are injected by the googlemap module itself ( and not very well at the moment I might add, but workable).

wellsy’s picture

yep I did install the location module first but I don't understand how I get the location information into an rss fee?

Is it that I create an new node and add some location information? you mention raw lat/lon input?

It is no doubt easy but I must have missed something here.

wellsy

orchidsonline.com.au

bensheldon’s picture

Once you have location module activated, there are two things you need to to do:

1) Administer -> Content -> Configure (tab) -> Content Types (subtab) -> [Node type you want to input locative data for, i.e. page or a flexinode] -> In this option you should have a lot of options to check for locative data. At a minimum you should check "Enable for Locations." If you enable full address fields (or even just zip codes) the location module will attempt a lookup of the latitude/longitude, but...

2) To input exact latitude/longitude you then need to go to Administer->Access Control-> and enable "submit latitude/longitude" for the users types you would like to have this control.

That's all there is to it. Now, hopefully, when creating a new node, or editing an existing node, of the type you enabled in #1 you should have some formfields where you can input locative data.

Location.module will automatically include these in the RSS feed.

wellsy’s picture

I have followed your instructions...Thanks!......but now I get the below error when I try to view an xml feed where the last test blog is included.

The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

Reference to undeclared namespace prefix: 'geo'. Error processing resource 'http://www.orchidauction.biz/interactive/blog/f...

 <geo:Point><geo:lat>
------------^

The map page also will not save the feed information (I assume because of the error?)

The preview option will not display anything either.

My test area is here
I also notice I am getting errors on the page now where I did not notice that before....I'll check that soon and report back.

Thanks again for your help here!
orchidsonline.com.au

bensheldon’s picture

Nuts. The issue you're having involves what I think is the location.module not creating a valid feed (I just commented about this here).

A quick, dirty fix would be to go into location.module code and comment out the lines that add the "geo:", "geourl:" and "icbm:" to the feed (I have lines 538 - 543).

urbanfalcon’s picture

If the description field -slash- node body was blank, then it would cause a fatal JavaScript error in IE. The map would display in IE, but the points would be lost to oblivion. Here's the fix:

In googlemap.module, replace

$content .= "      var description = item.getElementsByTagName(\"description\")[0].childNodes[0].nodeValue;\n";

with

$content .= "  if (item.getElementsByTagName(\"description\")[0].childNodes[0] != null){\n";
$content .= "      var description = item.getElementsByTagName(\"description\")[0].childNodes[0].nodeValue;\n";
$content .= "      } else {\n";
$content .= "      var description = \"\";\n";
$content .= "      }\n";
jiangxijay’s picture

I just installed a clean version of 4.6.5 and everything worked except for the "submit latitude/longitude" option, which doesn't appear at all. Is there something else I need to do?

jiangxijay’s picture

A clarification: when I navigate to Administer > Access control > Permissions, the location module doesn't appear in the list.

Is that where "submit latitude/longitude" is supposed to appear?

geodaniel’s picture

I like what you've done with the module, and look forward to seeing where it goes - I'm more than happy to help out as well.

Just wondering, was there any reason why you're not looking for geo:lat and geo:long tags in the RSS feeds (described here) - I think this should be a definate requirement for the parsing of geoRSS as it's the one that most people seem to be sticking to right now.

bensheldon’s picture

From your question I take it you've looked at the code. Currently it parses latitude/longitude tags and icbm:lat/icbm:long (not really, read below). I haven't implemented the geo: namespace for these reasons:

1) It is my understanding that location.module does not create a valid RSS feed because it does not include valid namespaces in the header. I do not think this is location.module's fault, but rather that the Drupal RSS API is not fully developed.

2) Because of #1, IE throws a couple errors and won't actually parse the feeds (Firefox apparently doesn't balk at invalid XML), which means you get a blank map. For this reason, even the icbm: tags don't really work correctly in IE, I just left it in there as a placeholder for when the namespace issues get resolved.

It is trivial to add in the geo: namespace, but at the moment I've had larger problems to deal with. Also, becase the googlemap.module can still only parse local feeds, which I assume are being created by Drupal's location.module which themselves are faulty, but include something (latitude/longitude) that doesn't have a namespace issue.

Thank you for pointing out the geo: tags though, as I'm trying to figure out what works best for maximum compatability. If you have any idea for a namespace for Googlemap's PolyLines (currently implemented as the tag "line") I would really appreciate it.

If you would like to help out, there are several things could use help on:

1. Philosophical: Workflow for lines (one line one node? multiple lines per node? line format? line color per feed or per node? line RSS tag)
2. Coding: External feeds. bjorn's code included a way to receive external feeds, but I could not get it to work.
3. Almost another project: How can we have users easily create line (and maybe even point) data. I've been looking at these examples:

http://vancouver.cyclehome.org/?q=gmapmacro
http://www.orchidsonline.com.au/interactive/node/3080
http://499angels.net/jonnyc23/tracer.htm

If you're interested, reply to the thread or send me an email bensheldon [at] gmail [dot] com

Thanks.

geodaniel’s picture

You're right about the namespace issues - I've hardcoded the geo namespace into my XML generator for now, but I believe 4.7 (or in cvs at least) has a way of passing extra namespace information in.

There's also another emerging standard, confusingly also known as GeoRSS which has other ways of representing things that seem to tie in more closely with Geographic Markup Language (GML). I think there is support in there for lines that may be what you're after.

As for local/remote feeds, I stuck in a proxy of my own to pull in Geobloggers feeds but it was getting caught up on some whitespace issues and not displaying everything I wanted it to. So I started trimming each line of the XML and it worked perfectly. Then I noticed about that proxy code that's already in the module, and tried that. With a few extra lines it seemed to work for me, but then stopped again. I need to look more closely into it.

I'm going to spend some more time on this tomorrow...

nk126’s picture

So I'm a newbie at Drupal and don't know much PHP at all ... but I've managed to figure out how to use Drupal with various modules, following patches and hacks I read about online, and figuring out bits of code enough myself to make some very very basic changes ... All just to say, forgive me in my ignorance ...

I'm running Drupal 4.6(.2, I believe) off of the install that my Web hosting service (hostrocket) provides with my account. I installed location.module and your updated googlemaps.module

aside: I just saw your reply to my post, ben, on the google maps for nodes module ... had already found your module, so thanks!

Running in Safari on Mac OS X it works well. If I enter Lat/Long coordinates as location data in a node submission, they show up on the googlemap as markers with teaser data just like I want 'em to.

I do wish I could get it to work simply by entering a street/city/state address and not the actual lat/long. Seems like there should be a way to pass the data to maps.google.com or somesuch place to do a look up, no?

Anyway ... I'm getting the XML parsing/namespace problem when I try the same thing on Firefox 1.5 Mac or IE on Windows. The maps load in Firefox and IE but no markers show. Clicking the RSS feed link itself generates the namespace error (whereas it shows up as a normal RSS feed in Safari).

Help?

Can this work in 4.6.x? Do I need to be running 4.7 or CVS to get it to work? You mention in the post above, "It is trivial to add in the geo: namespace" -- would that fix it for me? If so, could you tell me how?

I'm more than happy to contribute whatever I can to your development work ... I'm more of a tech generalist and idea/content person than a programmer, tho :-)

Thanks for the module ... At least in Safari it's letting me try out some ideas I had, and it's amazingly cool to see them come to life onscreen

cheers,
nk

bensheldon’s picture

In modules/location/supported/location.us.inc:
* Agree to line 82 because lookups use Geocoder.us which has a TOS
(commercial sites must pay for geocoding)
* Comment out line 81
* Uncomment line 84

In modules/location/location.module
* On line 799 replace
"location_get_postalcode_data($edit['location'])" with "location_latlon_exact($node->location)"
* do the same also on lines: 813, 839, 856

It worked for me, but honestly I haven't tested it a lot. The functionality is built into location.module, but apparently the interface hasn't been created to turn it on yet--which this hack does. Geocoder.us also may limit lookups to 1 per second. Checkout http://www.mapki.com/index.php?title=Knowledge_Base#GeoCoding for code snippets that you can use to replace the Geocoder.us specific code in location_latlon_exact_us function in modules/location/supported/location.us.inc

bensheldon’s picture

For the googlemap.module, my Javascript XML parsing is absolutely horrible--it may be dying when it finds an xml key it doesn't know.

In modules/location/location.module:
Try commenting out the 6 or so lines below line 933--the ones with georss and such. Leave only:

$items[] = array('key' => 'latitude', 'value' => $node->location['lat']);
$items[] = array('key' => 'longitude', 'value' => $node->location['lon']);

This is again, an ugly hack, though I think it has to do with the webrowser's handling of xml javascript libraries choking on the namespaces (or lack thereof).

benma’s picture

I'm very impressed - this is exactly what I am looking for, only that I wish to use it in 4.7... Is there work being done for an update? I really would like to help, but I'm just getting started with drupal and have absolutely no idea of coding...
I will be happy to bug-hunt, though!

Ben.

marcoBauli’s picture

Hey all,

the Googlemap module wen through different mantainers in the last times... Actually there is a newer alpha version of the mod that will be committed to cvs soon.

If interested in testing, please just contact me and i will send you the latest version of the mod.

Anyone looking for mapping features could be interested also in the Drupal enhancement proposals (DEP) for a generalized Mapping API at http://drupal.org/node/54963

please consider leaving there your 2 cents for it ;)

Cheers,
Marco

benma’s picture

Hello everybody,

something very interesting I just happened to come across using location, gmaps and view: I found it on planet drupal, have a look here for a demo and here for the howto.

Ben.

Ian Ward’s picture

Hi Marco, All,
I've just committed the googlemap.module version by Ben Sheldon, on behalf of Ben Sheldon, which is the 4.7 version w/ the enhancements discussed above to http://cvs.drupal.org/viewcvs/drupal/contributions/modules/googlemap/

Ian

Development Seed Blog

webgeer’s picture

I just thought I would mention that the gmap.module that is now tagged at 4.7 has just been significantly updated to add a lot more functionality to work with the location.module.

James
(webgeer)

Ian Ward’s picture

Hi James,
This is great. Ben mentioned the idea of using the gmap.module API to create the maps in GoogleMap. How do you see these two modules playing together? Should they be two modules? Or just one? If they're EDIT just one to stay as two separate modules ENDEDIT, do you think using the gmap.module API is the way to go? It would be great to find some merging points and then the focus could be adding functionality that's been talked about for googlemap.module, and without doubling any work already done w/ the gmap.module, and vice versa.

cheers,
Ian

Development Seed Blog

webgeer’s picture

I'm not sure what the best approach is from here. I have now included the feed capability into the macro filter. You can see what I mean by looking at: http://photo-tips.ca/node/42

I believe that this can be used to replace much of the functionality of the current googlemaps.module. (You just have to create the right macro and you will have the same type of page as googlemaps produced.)

Whether this is equal in usefulness, I'm not sure. It was just an easy solution for me. It still may be worth creating the googlemap.module (or googlemap_feeds.module may be a more approriate name to more closely indicate its function).

Personally I think that, unless there is a really good reason not to it is much better if all modules that interface with google use the same underlying api module, (which I think should be the gmap.module). This will significantly reduce the amount of overlap of work to be done, will help to ensure that the future modules are all compatible with future Google Map API updates. (Only the gmap.module would need significant upgrading if they change the interface), and it will concentrate the mapping effort in one place.

James
(Webgeer)