It would be fantastic if there was an option to associate different markers with taxonomy types (in a similar way that the gmap_location allows you to have different markers for different types of users and node types). That way on a city page you could have different markers for hotels, schools, etc.

CommentFileSizeAuthor
#12 gmap.js7.59 KBstephencameron

Comments

stephencameron’s picture

You can do this with using the macro term "|feed=blue::http://yoursite.com/taxonomy/term//0/feed". Where blue is the blue pin and is the number of the taxonomy vocabulary term you have.

By constructing a feed for a specific taxonomy this should work: HOWEVER - it doesn't work for me at the moment.

OK I get against node location map a set of the markers for all locations: but they are all the same - just as you say.

What happens in effect is the RSS output for any content you construct with a location screws up the XML for the geo:lat and geo:long tags which cant be read: The effect is to get a bunch of your nicelycoloured pins all sitting in the corner of your map instead of being placed correctly. I just need to know how to enhance the rss tagging parser to include geo: tags - its seems to think this stuff is just plain text - not a tag - so it interprets the grt and lt symbols.

This may be my problem - but it is worth trying out for yourself - and seeing it works. The same happens if I dont use node location but just a plain macro.

Good luck - I love the stuff so much - just wish Google would stabilise the code quickly enough as well as the API so we can get on with it. This is the last thing I would need to get going. All the AJAX changing and moving markers thing is for later.

webgeer’s picture

Just to clarify that the reason that http://photo-tips.ca/gmapfeeddemo showed the pins all in one corner is that after I had started to use the location settings of gmap_location.module in place of location.module I had turned location.module off. However, I forgot that the RSS feed requires location.module to include the lat/long information. I reactived location.module and this page again works as it is supposed to work.

To enable the RSS feeds to have the proper tags you just need to have location.module enabled.

stephencameron’s picture

I have location.module enabled. My site is bm.vortext.org so you can see for yourself. Just go to Area Map. I reloaded all modules and code as of 30th Aug - so it is all up to date.

The blue and red you see are the different node types (image_assist in page does not display - thats why I am changing the location based items to image node types as this works) - the feed items should use the large markers in a different colour set (as defined by the categories of the feed) - on FF they all appear in the top left hand corner (when you scale they still appear in the same reference point to the map image) - on IE they don't appear at all - is there something about my header changes that need to take place. My IE is 6.0.29 - which is still pretty usual.

Is it because these nodes are mixed with feed? How do you split them - as I add any node or image node with a location - it comes up in the map.

I will fiddle again - and I looked at your demo - and yes in IE it now works well - which is encouraging - so maybe I need to look at some other configuration settings.

stephencameron’s picture

I noted that your site has the extended [xmlns:v="urn:schemas-microsoft-com:vml"] in the header. Is this the problem - I thought this was only for lines - but is it necessary for feeds?

How do I change this in Drupal - just to be sure?

stephencameron’s picture

I noted that your site has the extended [xmlns:v="urn:schemas-microsoft-com:vml"] in the header. Is this the problem - I thought this was only for lines - but is it necessary for feeds?

How do I change this in Drupal - just to be sure?

stephencameron’s picture

Also the feed you have has ligit [geo:lat] tags with channel header definition of:

With my feed - the [geo:lat] and [geo:long] tags are corrupted by not being picked up as ligit tags. This is on generation.

The problem may be with my syndicator - where do I go to sort this out?

You can check this by just going to one /taxonomy/term/8 page to see the feed...

webgeer’s picture

Yes it seems that the problem is that your feed has icbm:latitude and geourl:latitude, and my parsing looks for icbm:lat and geo:lat. As you noted your geo:lat tags are corrupted as "<" have been replaced with &lt; I'm not sure what is causing this. Do you have any contrib modules that add some rss feed functionality?

I can add another step to the parsing so that it will accept one of these as well, However, I would not want to add too many variations, so if someone can comment on which of these is "more standard" I will add it to my parsing...

(You can try this yourself by editing gmap.js lines 135 and 139 to replace "icbm:lat" with "icbm:latitude" (and similar for lon).)

stephencameron’s picture

I absolutely have a vanilla site - I even created a new one yesterday - and the same thing happens. I have no code changes or contribs in the system.

I made the code change as you suggested - and still no go. I am now working exclusively in FF so at least I can see the corner markers.

Here is the XML feed snippet:

<geo:Point>&lt;geo:lat&gt;
  51.555401&lt;/geo:lat&gt;
  &lt;geo:long&gt;-0.166457&lt;/geo:long&gt;
</geo:Point>
 <icbm:latitude>51.555401</icbm:latitude>
 <icbm:longitude>-0.166457</icbm:longitude>
 <geourl:latitude>51.555401</geourl:latitude>
 <geourl:longitude>-0.166457</geourl:longitude>

Here is the parser code - changed:

    var lat = item.getElementsByTagName("geourl:latitude")[0].childNodes[0].nodeValue;
    if (lat == undefined) {
      lat = item.getElementsByTagName("icbm:latitude")[0].childNodes[0].nodeValue;
    }
    var lng = item.getElementsByTagName("geourl:longitude")[0].childNodes[0].nodeValue;
    if (lng == undefined) {
      lng = item.getElementsByTagName("icbm:longitude")[0].childNodes[0].nodeValue;

I did carry out some debug alerts and found that the lat and lng were still undefined after this.... it has stumped me.... and yet the colour attribute is being assigned to the correct category - so some category and title information is getting through!

I still have a concern about the interpretation of the geo:lat tag out of feed. Is there some header file that you define to the drupal render system that indicates whether there are special form tags in your map pages. Its seems strange that drupal/rss feed would ignore a perfectly good tag marker - unless there was an issue with the previous tag switching off tag recognition. Can we raise this with the core team at all? They may have an idea as to where to look.

IMO - you have enough information assigned in geourl and icbm - and you chose geo as well - is that because it is an emerging web standard (hence the previous check in the parser). I would definitely stick with what you have for now. XML schema proliferation is always a problem - because you have to do so much interpreting against it when standards dont exist for pretty formative types.

I have posted the code in the vain hope that someone will spot what the issue is. This is just too much of a good module to flounder on.

What I might try to do is run my map using your feed data and see what happens - that would be fun!

I have noted that my posting was corrupted above re: the feed address. I also found that simply putting a local address works as well (as you pointed out in your example page):

|feed=blue::/taxonomy/term/5/0/feed |

This of course makes things easier.

stephencameron’s picture

I have built a test page with your demo - using your feeds - so I know the XML is correct. The CA map comes up - but this time there are no markers whatsoever. Yet when I go to your site it works (through your site). I also note that when I try out the feed address - yes I get an XML page with all the elements.

I wonder am I missing something with the syndication of feeds or subscription of feeds - its really strange. I have never set up a feed to display on my site before - so I will experment to see if there are some dark settings somewhere.

I suspect the external process may reflect on the internal process also. Although things are working partially its not all there.

Are there any particular feed modules I need? What ones do you have(if any)?

stephencameron’s picture

I went to http://www.feedvalidator.org and as you are using relative addressing in your descriptor - I suspect only you can use your feed (which is good news for people who dont want their Drupal feeding everything - just add a local node reference!) - so that probably means my RSS feed interpreter has failed on using your feed and so no markers are displayed.

However more to the point the above site says that is an invalid tag - interesting. When I check my feed that is also the only problem I have. I will look up the geo:Point status to see where this is going.

Which module/inc implements the geo:Point tag? Is it in location.module?

Clearly going down the feed route is really important for this module in extending its functionality but a clean way.

stephencameron’s picture

Status: Active » Fixed

Sorted!

In looking through your gmap.js I found by learning about namespace references and the browser just aborting every time it came to the getElementByName - using the FF debugger.

You cannot use the namespace once declared in xmlns (unless you explicitly force it using getElementByNameNS("namespace","tagname")) in you tag name finds.

Simple remove the namespace references geourl and icbm from the tag search strings and you will have it working. You couldn't test this - as you always relied on geo:lat being there - which it wasn't for me).

Can I say it has been fun! But I am very happy it is working - although I am generating feeds which still generate broken geo:Point references - I don't care because I am picking up the other tags with geo coords in.

The next bit is to figure out why there is a problem with the generating of geo:Point tags. I note from w3c feedvalidator - that it even rejects it! Even the code example from w3c is rejected by its own validator when using geo:Point. Thats a problem! Rumour has it that it is optional. I suspect it is if used with an item structure - its kind of redundant - and it doesn't have more than one instance - kind of silly.

I will now look at location.module to see how the geo:lat tag is being badly generated.

I will enhance the code to include better checks for now. And put it here later.

stephencameron’s picture

Title: Setting markers based on taxonomy type » IE tested gmap.js completed ready for review and patch
Category: feature » task
Status: Fixed » Needs review
StatusFileSize
new7.59 KB

I have completed extensive testing of the gmap.js with amendments under both IE 6.0.29 and FF. It works even given the corruption of the geo tags. (which still exist - but this is not the modules problem - and my corrections are not in any way affected by this).

I attach the new .js with corrections/notes around the two routines changed. One has the cleaner parser for lat and lon which copes with both IE javascript syntax and FF rendering. I would do more but I am exhausted! The other has a correction due to IE not using some of the coding process - ie the use of responseXML for example but useing the GXml.parser (it is afterall a Google Mapping module!) as suggested somewhere in my research.

Please review this if you will and create a patch - I don' t have the tools. You could leave it for just a release build - but I suspect it overcomes alot of IE issues with feeds (i.e. reading external XML responses) - something I suspect not many have done but will start to do.

I am sure that this code is getting more stable - but with GMap development apace - we should make sure that the module is as documented as much as possible as we make design decisions on what we need to do.

So now my site: http://bm.vortext.org is ready with its mapping development - you can view various ways in which the maps use feeds from taxonomies. After more input of content it will probably go live next week.

There is a:

1. Area Map (which gives a set of markers over an area with different colours depending on what taxonomy term it belongs to) blue for cinemas, green for restaurants etc. This just has multiple feeds.

2. Legend Specifics (a legend on the right can be clicked and the map changes just to reveal the specific group of markers.) The markers are direct from the copies in the image directory as it is very difficult to use anything else. I would like to make this a block one day - but that will need some PHP as well!

3. I have used click through on a specific marker to go straight to the detail page (which includes a block google map of just that node) - this time using normal a node map using the co-ords in the node.

I can also ran a user location map - but have not made that available.

Clearly using this approach is such a good way of publishing taxonomy groups. No doubt someone will extend the API to do it differently. Everything just falls into place.

webgeer’s picture

I reviewed it. Looks good to me. Has now been committed.

webgeer’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)