Problem/Motivation

I am trying to build a map based on the result of an external web service call. I am trying to set up the map in a block module using a parsed macro. The code I have is:


...
 
$map_settings = gmap_parse_macro("[gmap id=dealermap |markers=small red::41.50394934137164,-85.82263183314353 |zoom=10 |center=41.50343510361136,-86.02981567382812 |width=600px |height=600px |control=Small |type=Map]");

$out .= "<!-- ************************************************************** \n";
			$out .= print_r($map_settings, true);
			$out .= "\n ***************************************** -->";

$out .= theme('gmap', array('#settings' => $map_settings));

...

The output that is then generated is:

<!-- ************************************************************** 
Array
(
    [id] => dealermap
    [zoom] => 10
    [width] => 600px
    [height] => 600px
    [maptype] => Map
    [controltype] => Small
    [longitude] => -86.02981567382812
    [latitude] => 41.50343510361136
    [markers] => Array
        (
            [0] => Array
                (
                    [options] => Array
                        (
                        )

                    [longitude] => -85.82263183314353
                    [latitude] => 41.50394934137164
                    [markername] => small red
                    [offset] => 0
                )
        )

)

 ***************************************** -->
<div style="width: 600px; height: 600px;" id="gmap-auto1map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto1map-gmap"><noscript>Javascript is required to view this map.</noscript></div></div>
</div>

No matter how I form the settings array, "auto1map" is generated as the class and ID on the div.

In the header in the Drupal.extend call there is this:

"gmap":{"auto1map":{"width":"600px","height":"600px","zoom":4,"maxzoom":"14","controltype":"Small","align":"None","maptype":"Map","mtc":"standard","baselayers":{"Map":1,"Satellite":1,"Hybrid":1},"styles":{"line_default":["0000ff","5","45","",""],"poly_default":["000000","3","25","ff0000","45"],"highlight_color":"ff0000"},"line_colors":["#00cc00","#ff0000","#0000ff"],"behavior":{"locpick":false,"nodrag":0,"nokeyboard":1,"nomousezoom":0,"nocontzoom":0,"autozoom":1,"dynmarkers":0,"overview":0,"collapsehack":0,"scale":0,"extramarkerevents":false,"clickableshapes":false,"googlebar":0,"highlight":0},"markermode":"0","id":"auto1map","longitude":"-92.109375","latitude":"33.578014746143985"}}

But there is no mention or settings applied for the id referenced in the settings array.

What am I doing wrong?

Comments

bestinc’s picture

Hello,

Did you ever find a solution?

I think I am having a similar problem.

All the best/