It's great that I can change the icons from the standard point but I'd like to be able to use different sized icons than the standard ones.

I was thinking about the best way to code it. For my purposes it seems like a waste to pass the information with each marker, as I only want a few different kinds of markers, not one for each point. Perhaps if it was possible to define (completely - including dimensions) the markers in the code instead of just the name and assuming the rest of the attributes are the same as the baseicon.

I'll try and post a patch for this later today.

CommentFileSizeAuthor
#1 gmap_markers.diff5.65 KBgeodaniel

Comments

geodaniel’s picture

Assigned: Unassigned » geodaniel
Category: feature » task
Status: Active » Needs review
StatusFileSize
new5.65 KB

Phew, that was a long day. I got distracted by other work but am back on track now. The attached patch adds the ability to define markerstyles. It's perhaps not the best implementation but it should do it's job. An example of the working code (extended by a custom module) is currently in place here.

Markers can be defined like:

  $thismap['markerstyles'][] = array(  // for users
    'name' => 'userIcon', 
    'image' => $base_url.'/modules/gmap/markers/face-smile.png',
    'iconSize' => array('width' => 16, 'height' => 16),
    'iconAnchor' => array('horizontal' => 8, 'vertical' => 8),
  );
  $thismap['markerstyles'][] = array(  // for content items
    'name' => 'contentIcon',
    'image' => $base_url.'/modules/gmap/markers/text-x-generic.png',
    'iconSize' => array('width' => 16, 'height' => 16),
    'iconAnchor' => array('horizontal' => 8, 'vertical' => 8),
  );

and then just reference these named icons as previously:

$newmarker['markername'] = 'userIcon';

If marker styles are defined, then the information that's passed in is used in place of the baseIcon information (which will fill the holes where custom information is not available). If styles aren't defined then the code will just look in the gmap/markers directory for a file called [markername].png

webgeer’s picture

Status: Needs review » Fixed

Hi Dan,

I decided to use a different method to achieve this. Any non-standard icons are placed in a sub-directory of the markers directory. Then the gmap.js is edited to create the baseicon information for that subdirectory. (It is clear what you need to do if you look at gmaps.js gmap_init() function.

I have predefined 3 alternate sizes. big which is a 30x51 marker similar to a standard marker in shape,
small which is 12x20 similar to a standard marker in shape, and flat, which is 16x16 with no shadow.

This version is the current cvs version

I hope that makes sense to you.

James

Anonymous’s picture

Status: Fixed » Closed (fixed)