Hello,
i am dealing with defining a few new custom markers for my Gmaps, but cannot make them work properly...
To start with, i followed the instructions about making own custom markers found at http://www.econym.demon.co.uk/googlemaps/custom.htm
I then added in the gmap.js file the following custom marker code:
baseIcon['spot']=new GIcon();
baseIcon['spot'].image='modules/gmap/markers/spot.png';
baseIcon['spot'].shadow='modules/gmap/markers/shadow.png';
baseIcon['spot'].iconsize=new GSize(16,14);
baseIcon['spot'].shadowSize=new GSize(5,10);
baseIcon['spot'].iconAnchor=new GPoint(16,14);
baseIcon['spot'].infoWindowAnchor=new GPoint(10,3);
baseIcon['spot'].infoShadowAnchor=new GPoint(16,14);
and changed of course the name of the marker in my feed so that it corresponds to code above and to the name of the png image uploaded into /modules/gmap/markers folder.
The result is that my new marker appears on the map, but it keeps the dimensions and anchor points of the default Google marker... (see screenshot attached).
Any help about this greatly apreciated!
Thank you in advance
marco
| Comment | File | Size | Author |
|---|---|---|---|
| Picture 3_0.pdf | 30.14 KB | marcoBauli |
Comments
Comment #1
stephencameron commentedMarco,
Don't understand what you have here.
Firstly the marker code in gmap.js is default code for the TYPE/LOCATION of marker standard, big, small and flat markers - not the marker itself. Standard is in the markers directory itself. Big, small and flat are in subdirectories of your markers directory.
So you are defining a new type of marker.
Clearly it is making sure that this new marker type becomes the default. I don't think this is where that would go.
Are you principally concerned with this happening when you "create a gmap macro"? or what?
If you are using a feed it is a simple matter for you to define the path and marker image like:
feed=spot/yellow::/taxonomy/term/4/0/feed
if you have a yellow.png sitting in a spot subdirectory of your markers directory.
If in your macro you also have a marker defined then this is defined by the settings of users or nodes default images - of course your spot/yellow should appear in this list.
Does this make sense? All you are doing is defining a new directory and default for a new set of markers when you touch or add a definition (except "standard" which has special dispensation).
Is this what you need?
Steve
Comment #2
marcoBauli commentedStephen, yes, i am trying to define my own markers for couple of feeds in a gmap macro.
The problem is that my markers don't have the usual (standard) 'drop' shape as we are used in Googlemaps, so (as is explained in the tutorial linked in my previous post) is necessary to adjust the settings of the custom marker in the javascript file.
Settings that need to be tweaked are size (height, width), shadow size, anchor point (the pixel that really points to the specific coordinate), ...basicly all the settings.
I tryed pasting that code above containing the right sizes for my marker, but they are still outputted "stretched" on my map and anchor points are not respected...
Hope i explained it a bit more clearly. Will try further also (maybe changing directly the 'standard' marker settings) and report back here of course.
cheers
Comment #3
stephencameron commentedI looked at your settings - and it is unusual that the shadow dimensions are completely swamped by the icon dimensions - so your shadow is completely within the dimensions of your image. It might be that the code sees that the dimensions are not correct - and simply defaults to the standard shadow size/icon.
Try changing the shadowsize to 25,14 instead. You have defined your info shadow so that the "light source" is coming from the top left as expected. But you have not left your iconshadow dimensions to reflect this also. Although I suspect the system isn't that intelligent - you never know!
You would at least expect the X coord to be greater for a shadow in terms of size.
Does this help? I would start with an icon twice the size of the normal marker - just to see that you are getting a real effect and you are in charge of the process. Once that happens - then you can shrink the icon sizes. Do you have image copies of the markers you can send so I can try it for myself?
Steve
Comment #4
webgeer commentedUsing the gmap.module if you want to create your own marker types (and not just new icons for a standard shape) with custom shadows and sizes, the correct way to do this is to first create a directory which we will call 'spot' in the markers directory and put the shadow.png and spot.png files in it. Then edit the code in gmap.js:
baseIcon['spot']=new GIcon();
baseIcon['spot'].image='modules/gmap/markers/spot/spot.png';
baseIcon['spot'].shadow='modules/gmap/markers/spot/shadow.png';
baseIcon['spot'].iconsize=new GSize(16,14);
baseIcon['spot'].shadowSize=new GSize(5,10);
baseIcon['spot'].iconAnchor=new GPoint(16,14);
baseIcon['spot'].infoWindowAnchor=new GPoint(10,3);
baseIcon['spot'].infoShadowAnchor=new GPoint(16,14);
Then in your pull downs you should have a marker choice: spot/spot
Hope that works for you.
Comment #5
texas-bronius commentedHow can one define a custom marker (customized png and shadow) in 5.x-1.x-dev? I don't see that gmaps.js is even included in /admin/settings/gmap_location config screen wherein I think I would expect my custom marker to appear as an option (following webgeer's solution to this issue Sep2006).
I'm hijacking and updating the same question that seems to have gone stale after 2006 with an apparent resolution but which remained "active".
Comment #6
bdragon commentedIt's totally different in 5.x.
What you need to do is create an ini file to describe the markers you added.
Look at the preexisting INI files in markers/ for examples.
Comment #7
bdragon commentedMarking as duplicate of http://drupal.org/node/181208.
Thank you for your issue.
Comment #8
wintervanilla commentedI am unable to get this to work for me. Where in gmap.js should I insert this code? I'm unfamiliar with javascript :(
Comment #9
danielb commentedI agree with wintervanilla, what the hell people!!!
Comment #10
nicholasthompsonCreate a new ini file and enter something like the following..
You also now need to put a
beer_pint_full.pngimage into the markers folder.Next - and this is important™. EMTPY CACHE. I wasted half an hour wondering why my marker didn't appear. It looks like the parsing of the ini files for the markers gets cached - which is a good idea really!
Once you have done the above, you will see Beer Pint Full in the drop down menu options in the likes of GMap Location. You will also be able to refer to
beer_pint_full(or whatever you put in the square brackets) as an ID for the marker.@BDragon - is there any documentation for Location which can be maintained by those who have been using it a bit?
Comment #11
danielb commentedlol I can't believe I used to have so much trouble with this module, now I'm twirling it on my finger like a basketball and making all manner of proximity finders and doing my own 'best zoom' calculations.
Comment #12
squarecandy commentedAnyone gotten something like dynamically customized markers to work? It sounds like a long shot I know, but is it theoretically possible to have, say, a 20px square version of an imagefield graphic that a user uploads as the marker for that user's content profile node?
Just curious if someone has either tried and failed miserably or tried and succeeded....
Comment #13
marchanda commentedI'm also interested in what supercandy is asking about (using imagecached user photos or an imagecached imagefield from a node as marker image). There's a site (I think it's Adult Friend Finder... don't ask me how I know) that does this. Does anyone have pointers on how to get started with this.
Comment #14
greg.harveyIf you don't want your markers in the module directory (which you shouldn't, frankly) then this thread holds a really nice solution:
#901596: Use libraries api module for storing markers
Comment #15
arruk commentedI can'd delete this comment posted to the wrong page... sorry