Posted by dixon_ on April 20, 2009 at 11:42pm
| Project: | Mapstraction |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
With this patch we allow each node/marker to have different and custom icons.
To test:
- Add a CCK text field to a node type that appears in your map.
- Enter a URL to your custom icon in this node field.
- Map the field with the "Icon URL" field in the Mapstraction view style options.
- Find the custom icon on your map :)
I'd suggest that we commit #437644: Set initial point dynamically first, then re-roll this patch to work with dev. We also have to change the element descriptions to document this function better. But that can go in a later patch...
| Attachment | Size |
|---|---|
| icons.patch | 1.67 KB |
Comments
#1
Rerolled this patch after committing #437644: Set initial point dynamically. Still needs to fix element descriptions.
#2
Tested successfully, so committing the patch from #1. But I mark this as still needs work because we need to change the element descriptions for this functions to be documented correctly.
#3
This works for me. I am using it based off of values on dropdowns so I have to override the view field for that content field and return the image path, but it works.
#4
I have setup a view with an argument to sort out map locations. If I bypass the argument with "all", I get my custom icons. However, if I use an argument I only get icon shadows on the map and no icons. The view without arguments at all will give custom icons.
I tried to look it over some, but only knowing enough javascript to be dangerous, i had no luck. I have checked in mapstraction.js and in Marker.prototype.setIcon=function looks like iconUrl is getting the value just fine. I checked mapstraction.drupal.js and marker.setIcon(this.icon); is getting a value as well. If I comment this line out, i get default icons.
#5
Is this really best as an enforced option? When setting up a view at the moment the Icon URL field is a required field. Wouldn't it be better to default to, well, default icon markers, and give users the option to select custom icon fields if they wish to?
#6
I'd also vote for having a default, not all views results will involve images suitable for use as an icon.
#7
As a stop-gap what I've done is:
/sites/all/themes/mytheme/markers/number[counter].pngThis then shows up to 26 numbered icons, which is sufficient for my (current) needs.
#8
thanks for the useful tip.
#9
#10
Automatically closed -- issue fixed for 2 weeks with no activity.
#11
DamienMcKenna: this seems like an ideal solution but I can't get this to work. I'm using the latest 2.x-dev version.
What happens is that all my markers get stuck at the top left corner of the map. The markers seem to get stacked on top of each other and not even the info bubble is working. Looking at the source all the data including correct icon sources seem to print okay. Anyone else having any problems with this?
#12
The custom icons are working in 2.x, I have it live on 2 production sites. It sounds like the lat/lon of the nodes are all the same, at least as getting rendered in the view. Also make the sure the path provided for the icons is actually there.
#13
I can't figure it out. The view is working fine when not using the custom icons. When enabling "Icon URL" to match my icon field (done like in #7) the result is that all the markers are positioned at the top left corner. I can't spend any more time on this, perhaps it'll 'fix itself' one day.
#14
FYI this was finally solved by not using a preceding trailing slash i.e. sites/all/themes/mytheme/markers/number[counter].png. I'm using a multi-site install so perhaps that has something to do with it? Also absolute paths don't work either. This was a real pain to track down but if anyone else is having trouble try without the trailing slash.