Project:GMap Module
Version:6.x-1.1-rc1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: map109

I only have one map one the page..
Any one have any hints...

---
J.

Comments

#1

Any idea how to solve this duplicate error ?

#2

sorry, I usually post fixes as I find them. It turned out that I was using contemplate for both the teaser and node displays. The duplicate map error is because the node was loading both the teaser and the node. Several modules do this. In my case it was nodewords. hope this help you trouble shoot your problem.

--
J.

#3

Any progress on this error? I get this error message in D5.

#4

Subscribing.

I had to deactivate nodewords to get my map to display.

#5

Yes I have the same problem, when I turn off nodeword everything works.
Is there any soloution to solve this problem, without turning off nodewords module?

#6

Version:6.x-1.x-dev» 6.x-1.1-rc1

Drupal 6.14

Same problem here! Only with a different module - Page Title 6.x-2.2

Posted a new issue : http://drupal.org/node/604484

#7

Page Title and Nodewords modules are important for SEO. It's really difficult to make a choice between having a search engine friendly website or working Google Maps. Can someone please take a look at this issue?

#8

Trackfield module got it too.

Szy.

#9

For Nodeword, there's a setting that that asks if you want to load the node teaser. Disable it. Should work as it won't be load 2 maps with the same ID.

Off the top of my head this might be a FIX ALL....

For the node type that has a map, over ride both the teaser and node templates (using contemplate or hard-disk node.[node-type].tpl templates).

Make sure they both have different ids.... example (first line of each array).

NODE ---

<?php $points = array(
           
'id' => 'mapnode'.$node->nid,
           
'width' => '450px',
           
'height' => '200px',
           
'latitude' => $location['latitude'],
           
'longitude'=> $location['longitude'],
           
'zoom' => 15,
           
'controltype' => 'Small',
           
'maptype' => 'Map',
           
'markers' => array(array(
           
'latitude' => $location['latitude'],
           
'longitude' => $location['longitude']
            ))
            );
            print
theme('gmap', array('#settings' => $points)); ?>

TEASER---
<?php $points = array(
           
'id' => 'mapteaser'.$node->nid,
           
'width' => '450px',
           
'height' => '200px',
           
'latitude' => $location['latitude'],
           
'longitude'=> $location['longitude'],
           
'zoom' => 15,
           
'controltype' => 'Small',
           
'maptype' => 'Map',
           
'markers' => array(array(
           
'latitude' => $location['latitude'],
           
'longitude' => $location['longitude']
            ))
            );
            print
theme('gmap', array('#settings' => $points)); ?>

You'll obviously have to add all the other field for that content type if you haven't already.

Let me know if this works. Curious. But, it should fix the duplicate id error for any module that loads both teaser and node...

#10

CorpX,
Thank you for posting this. Unfortunately, my PHP skills do not allow me to try your solution. Hope it works for someone else. Will keep waiting for a new Gmap version, hopefully it is not far away (the last time I checked they rolled back to v.1.0).

#11

Subscribing, having same issue using contemplate..greetings, Martijn

#12

Greetings: not sure where the problem is coming from, but it just popped up for me when I installed and ran the first linkchecker (http://drupal.org/project/linkchecker) scan on a D6.15 site:

Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: nodemap

The site does make extensive use of GMaps, but I'm not sure what the reference to "nodemap" actually means.

#13

Hey folks. take a look at #9. What I've noticed is that - especially using contemplate, most of us tend to just copy and past code into the node and teaser areas and hope that it works. it well unless you have a module installed that needs to load the teaser in addition to the node that you are viewing. In this case, since you've copied the same code drupal is essential tring to load 2 maps to the same map ID.

If you look at the first element in the arrays above you'll see that they've been changed so that the ids are different.

'id' => 'mapnode'.$node->nid,

'id' => 'mapteaser'.$node->nid,

otherwise is the same snippet. now if the teaser and node are loaded they have 2 different IDs. Hope this helps. This also impacts those using files for themeing and its essentially the same as using contemplate.

#14

You might often want a Gmap on the same node as a URL which uses the Link module: http://drupal.org/project/link (like a "Contact" page!).

The trouble is, if a Link field is present you get this Duplicate Map error again. So it's quite a problem.

Going by the multiple reports it certainly does seem to lie with Gmap rather than with other modules...

#15

Subscribing, having the same..

EDIT: Working solution is adding

.$node->nid

to the Gmap ID as stated above!
greetings, Martijn

#16

subscribing, having the same using trackfield module (not using page title or nodewords by the way).

I don't see anything wrong with the code in the trackfield module:

...
          /* Default is gmap embedded */
          $path = sprintf(' |line=#%s/%d/%d:%s', $path_colour, $path_width, $path_opacity, join(' + ', $line_points));
          $gmap = sprintf('[gmap zoom=%d |center=%s |width=%dpx |height=%dpx |id=%s %s%s%s]',
            $zoom,
            $map_centre,
            $gmap_width, $gmap_height,
            "trackfield_map_" . $node->nid . "_$formatter",
            $trackfield_map_format_sizes[$formatter]['gmap_attr'],
            $path,
            $markers);

          _gmap_doheader();
          $out .= gmap_filter('process', 0, 1, $gmap);
...

Also tried the latest -dev of gmap, same results.

#17

I faced this problem to. What I have is a node and in it you can reference various nodes containing a Gmap. If you reference twice the same node, it appears the error

Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: 53

I am using a template to draw the nodes that contains a Gmap and debbuging the code I saw the problem is taht when calling to ther function to get the map, you have to pass a parameter as the map ID, so if you use the node ID it will be duplicated.

To fix it, I have used PHP rand() function to get a random ID to generate the map:

Code needed in node-CT.tpl.php is:

    <?php
      $rand
= rand();
   
?>

    <div class="entry-<?php print $rand?>-<?php if ($sticky) { print " sticky"; } ?>" style="float : left; padding-right: 1.5em;">
      <div class="ct-map-content"><?php print $node->content['body']['#value'] ?></div>
   
        <?php
         
# Call Map Function
          # I have separated the parameters so that it easier to see
         
print node_map_maker(
           
$rand, 'small red'
           
,$node->locations[0]['latitude']
            ,
$node->locations[0]['longitude']
            ,
16
           
,'300px'
           
,'200px'
           
,'Small'
           
,'Map: Standard Street Map.'
         
) ?>

    </div>

Code needed in template.php:

<?php

#function to make Gmap macro data into a map
function node_map_maker($id, $mark, $lat, $long, $zoom, $width, $height, $control, $map_type) {
 
#intialize output
 
$output = '';
  
 
#put together array
 
$arr_map = array(
       
'id' => $id
 
,'zoom' => $zoom
 
,'width' => $width
 
,'height' => $height
 
,'latitude' => $lat
 
,'longitude'=> $long
 
,'maptype' => $map_type
 
,'controltype' => $control
 
,'markers' => array(
  array(
               
'markername' => $mark
 
,'latitude' => $lat
 
,'longitude' => $long
 
)
  )
  );

 
#display map through GMap theme function
 
$output = theme('gmap', array('#settings' => $arr_map));
  
 
#return output
 
return $output;
}
#end function
?>

#18

Anyone figured this one out yet?

I'm using trackfield with no problems, but get this error when i add a cck link.

Tried giving different id's to node and teaser versions in node-CT.tpl,php (see #9 above), but that didn't work.

Tried latest dev version, but that didn't work

Surely someone is using gmap and links on the same node - so how'd you do it?

#19

Having the same issue with a custom module I wrote. This is really weird. I get the error 5 times:

Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: gmap-1897-a7c37d8c590f903b4b30185fe7e3cd56

Here's part of the code

<?php
function theme_venued_events_map($node)
{
   
$output = '';
    if (
$parents = venued_events_get_parent_nid($node->nid)) {
       
$output .= '<div class="field field-field-location">'.
           
venued_events_get_map_output($parents[0]->nid, $options = array('width' => '400px', 'height' => '350px')) .
           
'</div>';
    } else {
       
$output .= '<div class="field field-field-location">'.
           
$node->field_location[0]['view'].
           
'</div>';
    }
//endif;

   
return $output;
}
?>

If I comment out the function call to venued_events_get_map_output the error goes away. The really weird thing that's not event the code segment being executed on the page. The page is executing the else portion. This makes me insane.

Here's the code that makes the map

<?php
function _venued_events_get_node_map($node, $options = null)
{
   
$marker_popup = "";
 
$places_gmap_setting = array(
     
'id' => 'gmap-' . $node->nid . "-" . md5($_SERVER["REQUEST_URI"]),
     
'type' => 'Map',
     
'maptype' => 'Hybrid',
     
'controltype' => 'Small',
     
'width' => (isset($options['width']) ? $options['width'] : '450px'),
     
'height' => (isset($options['height']) ? $options['height'] : '400px'),
     
'zoom' => '17',
     
'latitude' => $node->field_location[0]['latitude'],
     
'longitude' => $node->field_location[0]['longitude']
    );
 
$marker_popup .= '<div class="point-title">' . $node->title . '</div>';
  if (
module_exists('image_attach')) {
   
$marker_popup .= $node->content['image_attach']['#value'];
  }   
 
$marker = array(
   
'text' => $marker_popup,
   
'markername' => 'blue',
   
'autoclick' => true,
   
'longitude' => ($node->field_location[0]['longitude']),
   
'latitude' => ($node->field_location[0]['latitude'])
  );
   
$places_gmap_setting['markers'][] = $marker;
   
$output = theme('gmap', array('#map' => 'venued_events_map', '#settings' => $places_gmap_setting));
  return
$output;
}
?>

#20

Guys!!! Awesome! I think i find the solution (or maybe just one of the solutions).

In settings of block of Location there is "Map Macro" field (see screenshot).
There is id=usermap setting.

Need to DELETE this.

WRONG:
[gmap |id=usermap|center=40,0|control=none|zoom=12|width=100%|height=300px]

NEED:
[gmap |center=40,0|control=none|zoom=12|width=100%|height=300px]

I think in this case id will generated automaticaly and all is ok.

AttachmentSize
gmap-id.jpg 251.15 KB

#21

Found the same solution as #20, but I was using an attachment and cck location.
Delete id from the macro in Attachment>Style:GMap>Macro

#22

I'm still getting this error message on my site, and I checked the set-up from #20 and that doesn't seem to be the issue, as id=usermap is not there. Instead, it reads

[gmap |width=100% |height=200px |control=None |behavior=+autozoom +notype]

My exact error message reads:
Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: trackfield_map_145_default

Any suggestions on how to resolve this error from coming up?

#23

At the very least, I would like the error to stop showing up for users on their page. I have write errors to screen turned off, but the "Duplicate map detected" is still showing up on the screen periodically for anonymous user.

My exact error message reads:

"Duplicate map detected! GMap does not support multiplexing maps onto one MapID! GMap MapID: trackfield_map_151"

#24

solution #20 seemed to work for me ... I had two GMAPS on one page ... and removed both id's in Site Configuration > Gmap Location > ...

#25

#20 also does it for views in 7.x. I had been using unique id's for the map views I was creating and was getting the same error when the views were embedded in nodes and the nodes displayed on teaser lists.

Removing the id= part of the macro fixed it and it had no other impact on displaying the maps (I'm only doing one map per page though, so I haven't tested if multiple maps will fail).

#26

#20 also worked for me! Thanks for the tip. I think the problem at my site has started by activiting the fusion starter theme

#27

In my case, I had to remove the id from a custom made view, but #20 works nevertheless.

#28

#20 did not solve my problem. I'm still getting the error message consistently on my site. At the very least, I would like a way to hide this message from anonymous users, because it shows for them too.