Unless there's an operator error being made, this seems to be a bug.

I've created a view showing multiple nodes on a map. For the content type of the nodes used, I've selected a marker type that has numbers. It would seem, then, that each marker on the map should have a different number, but they are the same.

Comments

markDrupal’s picture

ditto this. I am making a call to the theme funtion "gmap" with markername as "number"

there is no incrementing of marker numbers, I just get a bunch of markers with the number 0

ultimike’s picture

I think the problem is one of two things, but I'm unsure exactly which it is...

Each marker can have an "offset" value that dictates its place in the sequence of markers. So, if you have 3 markers that should be getting "numbers" icons, then each of those markers should have a unique offset (0, 1, and 2 - I believe).

Looking at the code, I think the offset can be designated via PHP or JavaScript. It appears that if the PHP code doesn't assign an offset, then the JavaScript code attempts to. I think this portion of the icon.js file is relevant:

Drupal.gmap.getIcon = function(setname, sequence) {
  var sequences = [];
  var gicons;
  var othimg = ['printImage','mozPrintImage','printShadow','transparent'];
  // If no setname, return google's default icon.
  if (!setname) {
    return G_DEFAULT_ICON;
  }
  // If no sequence, synthesise one.
  if (!sequence) {
    if (!sequences[setname]) {
      sequences[setname] = -1;
    }
    sequences[setname]++;
    sequence = sequences[setname];
  }

If I'm following the code correctly, I think that for each marker, a call is made to Drupal.gmap.getIcon. This function expects 2 things - a marker set name (like "numbers") and an offset (called "sequence" in the code snippet). If it doesn't get an offset (sequence), then it tries to generate one on its own. This is where I think there is a bug in the code. The array "sequences" is initialized everytime getIcon is called - meaning that it is always going to be empty when the "if (!sequences[setname]) {" line is reached. This means that it will always be set to -1, then incremented to 0. Then the sequence (offset) is also 0 - for all icons. It looks to me like the "var sequences = [];" call should be made globally (maybe in Drupal.gmap?) so that it remembers values from icons that have already been generated.

Then again, the bug might be in the fact that the offset was never defined in the PHP code. I'm not familiar enough with the code yet to know for sure.

Hopefully someone who knows more than I will be able to take a look at this and know the best way to fix it.

Hope this helps,
-mike

2xe’s picture

I can confirm this issue; I'm having the same problem using the API. They are all zeroed... :(

bdragon’s picture

I can confirm that the code is stupid and broken.

bdragon’s picture

Version: 5.x-1.0-alpha1 » 5.x-1.x-dev

I made an attempt at fixing this in -dev.

It's still got an issue (sequencing is global instead of per-map) but fixing that issue will have to wait for some minor refactoring...

slake’s picture

It's been a number of months since the last post. Has anyone found a fix to this yet?

asak’s picture

subscribing.

kkrgopalan’s picture

subscribing

j0k3z’s picture

still no fix?

bensquare’s picture

subscribing

kerrizor’s picture

bump

beanjammin’s picture

I see this was originally posted for 5.x.1.x-dev, I'm running 6.x-1.1-rc1 and seeing the same non-incrementing letter/number markers. Is it safe to presume this is the same bug? Interestingly when I use a gmap style from a view it works properly.

beanjammin’s picture

Title: Not incrementing marker number » SOLVED - Not incrementing marker number

Happy to report that as ultimike suggested in #2, the offset value has to be set in the markers array and then number/letter incrementing works properly.

bensquare’s picture

thx you very much for the tips ^o^

it is working now, for dummy people like me, here is the guide

u go to the icon.js files

sequences[setname] = -1;

to

sequences[setname] = 0;

then it will work

thx for the great module

jimsmith’s picture

I agree. The icon sequence is correct when line 32 of icon.js is change from

this.sequences[setname] = -1;

to

this.sequences[setname] = 0;

bensquare’s picture

Jns and others,

have u got this problem too ?

while it seems the map showing some numbers, but the sequence is not correct. (I am using latest v6.1 dev)

I think it's a bug on the default /map/node

jimsmith’s picture

The bug report was for 5.x-1.x-dev. I have not tried to use sequence markers on any of my D6 sites, so I can't answer that question.

bensquare’s picture

I found a fix, bascially, the icon.js file in the 6.1 dev is fine, (setname = -1) is actually correct, but the sequence function in the default node map (map/node) has a bug and caused the wrong sequence. However, you can fix this by creating a NEW NODE MAP yourself using VIEWS and then it will be fine...

podarok’s picture

Status: Active » Closed (won't fix)

release unsupported
feel free to open issue against latest 7.x dev