Hi,
I try to use the module but my below example doesn't show map. Hereby my screenshot. There is an issue in JS but don't find it...
Someone can help me ?
$map = leaflet_leaflet_map_info();
$features = array(
array(
'type' => 'point',
'lat' => 44,
'lon' => 6.45,
'icon' => array(//'iconUrl' => 'sites/default/files/mymarker.png'
),
'popup' => $title,
'leaflet_id' => 'someID'
),
);
print leaflet_render_map($map, $features, "100px");
Firebug error :
TypeError: this.map.settings is undefined
[Stopper sur une erreur]
if (this.map.settings.layerControl) {| Comment | File | Size | Author |
|---|---|---|---|
| Screen Shot 2013-05-23 at 3.05.09 PM.png | 58.89 KB | jim005 |
Comments
Comment #1
chrsnlsn commentedSame for me, just a grey map with zoom controls. Anyone confirm that the API is working for them?
Comment #2
timdavison commentedI think you need to set up the $map variable with a call to leaflet_get_map_info(). I've used the code below in a block to test the api and it all works fine for me. (OSM Mapnik is the default map set up by the leaflet module).
Comment #3
jim005 commentedGreat ! It works ! ... So easy now, I can switch to leaflet easily :-)
Comment #4
rdeboerComment #6
vistree commentedHi, where to use the api if you want to manipulate an existing views leaflet map?
I want to change some of the feature settings or set a new layer by code.
Tried several leaflet-functions .. Or do you need to use a jquery-script?
Comment #7
szeidler commented@vistree: there is a
hook_leaflet_map_info_alterthat can be used to manipulate the configuration of any existing map.