I have been thinking about some things I would like to do a bit differently with the GMap module. I think it is time to clean up some things and optomize some other things and generally make a number of improvements. My first plan of what to look at is the javascript produced and specifically the marker creation and manipulation js.
I am thinking that rather than having the gmap.module create the js to write the markers I will have the gmap script to a drupal_to_js() conversion of the markers array and then have it call a function in gmap.js to add the markers from the array that is created. This will allow easier extending of capabilities of the gmap functionality.
I think I will need to make some changes to the gmap associative array for this to work. Specifically the latitude and longitude will have to be set as two different items. For some functionality I will be adding an "id" for the marker. I will also change it so that there is an "onClick" field so you can have the map perform an arbitrary js on clicking the map.
Most of this should be entirely transparent to the user and even the developer. I will probably add the ability to be backwards compatible by having it automatically parse a 'point' element into 'latitude' and 'longitude' elements.
As part of the same plan I will also try and make the syntax of the js much more standards compliant.
The new associative array for a marker will be:
<?php
$marker = array( 'id' =>
'latitude'=>
'longitude' =>
'html'=>
'tooltip' =>
'markericon'=>
'onClick' => )
?>The old names for the items will probably continue to be accepted and will be run through a conversion function to switch over.
I open this up for comments and thoughts. I'm not really sure when I will get all of this done, but I will probably setup my cvs sandbox and put a copy in their for testing as soon as I get going with it. If others would like to help I could definitely use some help. Especially from those who are knowledgeable in javascript.
James
(webgeer)
Comments
One willing Tester
One Willing tester available here.
GMap, has, unintentionally, become a very important part of my site, so I'll be willing to help test when I can.
Regards
Alan
how about AJAX + gmap?
webgeer,
playing w/ my (fantastic) gmap-powered pages, i think it would be really cood to have AJAX-powered markers. By that I mean, a user perusing a map could change a value in a dropdown box (or move a slider) and would instantly see the markers change without page refresh. Would that be possible?
dado
Funny you should mention
This is exactly what I do with mapthing. I also have been integrating mapthing with gmap - so that mapthing uses the gmap api to render the map. Webgeer has been very generous with his time helping in this integration and now we're trying to figure out if gmap needs some extensions that would (IMO) make what you want more doable.
Right now mapthing uses ajax to allow a node editor to change the set of markers interactively on the map. This could be easily extended to allow end-users to "layer" different sets of markers etc. The drawback with mapthing right now is that it assumes that you have CiviCRM. However I have factored out the CiviCRM stuff into an "add-on" module - there is still some hard coding - but it is down to a line of code.
So the net/net is that what you want to do is eminently possible - and exactly the direction I'm headed with Mapthing.
wow cool
drob,
This sounds very cool indeed. Integrating w/ gmap & removing CiviCRM dependency seems smart. Is the module ready for testing in its CiviCRM-independent form? Where? Thanks
It's in CVS
in contribs under "mapthing". The version there is not integrated with gmap yet - however it all works (or at least that's what folks tell me :) ). It is heavily documented and as long as you have CiviCRM (and some groups with contacts that have lat/longs) it should work - ping me if it doesn't. I always intended to make it independent of CiviCRM - but that's what point versions are about :).
Agree with your push...
I have two sites am I keen to work with having maps of say yellow markers for restaurants and blue ones for shops etc.
Having had some odd behaviour from IE and FF with respect the feed macro extension - specifically from my own site - I notice the demo for the feeds on gmap.module is also broken: Markers are not being generated, or if they are they all sit in the corner of the image. Simply I generate some category feeds that work fine - but can't seem to pick up the lat/long correctly in gmap.
With the extension of movable markers in the GMap API I can see that your strategy is a good one structurally.
Some errors I have found - I note that my pages generate RSS which is broken for tags - which are defined in the args likely (how do I patch that?) - which screws the the GeoParseRSS from picking up the lat and long. And the picking up of the as a backup doesn't seem to work: so I just get lat and lng undefined.
I am resorting to have just node location map for all nodes - irrespective of category - as there is no other way of controlling the scope of nodes to a map without feeds.
Clearly this may be an issue with keeping up with Google V2 - now at 2.60 and updating tags - but may be down to, as you say, the fact that you have the lat and long combined in the field which needs to split correctly.
I am all for helping out - my javascript used to be damn good - but I am rusty - and things have moved on so much.... I want to put my sites to demo - with some words on how to set things up - there are plenty of stumbling blocks for newbies to drupal (me being one!) and i think it might help if I can document for you guys if need be.