- Issue created by @dmudie
- Status changed to Postponed: needs info
over 1 year ago 9:39pm 12 June 2023 - 🇮🇹Italy itamair
No no no ... reporting so little is not a proof of a Bug.
You should add better evidence and description (and also screenshots) of what you experience and how to reproduce your use case,
to claim for a module bug and eventually support on that ...
You didn't even mention from which version you are upgrading to 10.0.14.Did you flush all your drupal cache after upgrading?
Don't you mind that no body else reported this yet? - 🇺🇸United States dmudie
Upgraded from the 2x version. I flushed cache. I'll try to work on a simple reproducible case since my custom map is anything but simple, but was working previously. As for the snarkiness, I do actually mind that nobody else reported this, but I'm hoping that someone might experience something similar, and 100% of problems have a first report. I'm not saying that it's a bug, but that seemed the best category since console is showing an error. It doesn't really fit "support request."
- 🇮🇹Italy itamair
ok ... but you didn't even mention if this bloks/breaks your Leaflet map from being seen/rendered,
or you are just experiencing this error message in the js console and that's it? - 🇺🇸United States dmudie
I created a simple test. Maybe something has changed in how custom map settings are retrieved?
controller:/** * Maptest */ public function maptestPage() { $points = []; $content['#title'] = t('Map Test'); $map_info = leaflet_map_get_info("mymodule_map"); $lat = '29.779860'; $lng = '-95.257426'; $points[] = array( 'type' => 'point', 'lat' => $lat, 'lon' => $lng, ); $content['map'] = \Drupal::service('leaflet.service')->leafletRenderMap($map_info, $points, '480px'); return $content; }
custom module:
function mymodule_leaflet_map_info() { return [ 'mymodule_map' => [ 'label' => 'Mymap', 'description' => t('This is a custom map style.'), 'settings' => [ 'dragging' => TRUE, 'touchZoom' => TRUE, 'scrollWheelZoom' => TRUE, 'doubleClickZoom' => TRUE, 'zoomControl' => TRUE, 'attributionControl' => TRUE, 'trackResize' => TRUE, 'fadeAnimation' => TRUE, 'zoomAnimation' => TRUE, 'closePopupOnClick' => TRUE, 'minZoom' => 1, 'maxZoom' => 18, 'zoom' => 2, 'layerControl' => TRUE, 'layerControlOptions' => [ 'position' => 'topright', ], ], 'layers' => [ 'layer' => [ 'type' => 'sat', 'ext' => 'jpg', 'urlTemplate' => '//server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', 'options' => [ 'attribution' => 'Map tiles © Esri', 'noWrap' => FALSE, ], ], ], 'plugins' => [], ], ]; }
I do not get any points on the map. There must be something with calling the custom map because when I use:
$settings['leaflet_map'] = 'OSM Mapnik'; $map_info = \Drupal::service('leaflet.service')->leafletMapGetInfo($settings['leaflet_map']);
instead of leaflet_map_get_info then the map renders. Thanks for your time.
Yes, i have the same error after upgrading the last version of module.
In my map, i haven't the point showen, and i have this error in my log:Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at e.addTo (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:47976) at e.addControl (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:48396) at e.setPosition (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:47744) at Drupal.Leaflet.initialise (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:384:27) at new Drupal.Leaflet (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:335:10) at loadMap (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:156:45) at HTMLDivElement.<anonymous> (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:301:13) at Function.each (js_CYQ6r7TeQI0dQWzRG1ePrldDAZeH0vtIgvXcBeI4By8.js:2:3003) at E.fn.init.each (js_CYQ6r7TeQI0dQWzRG1ePrldDAZeH0vtIgvXcBeI4By8.js:2:1481) at Object.<anonymous> (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:147:26)
- Status changed to Active
over 1 year ago 8:06am 21 June 2023 Yes, i have the same error after upgrading the last version of module.
In my map, i haven't the point showen, and i have this error in my log:Uncaught TypeError: Cannot read properties of undefined (reading 'indexOf') at e.addTo (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:47976) at e.addControl (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:48396) at e.setPosition (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:132:47744) at Drupal.Leaflet.initialise (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:384:27) at new Drupal.Leaflet (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:335:10) at loadMap (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:156:45) at HTMLDivElement.<anonymous> (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:301:13) at Function.each (js_CYQ6r7TeQI0dQWzRG1ePrldDAZeH0vtIgvXcBeI4By8.js:2:3003) at E.fn.init.each (js_CYQ6r7TeQI0dQWzRG1ePrldDAZeH0vtIgvXcBeI4By8.js:2:1481) at Object.<anonymous> (js_I9lN5pAKQHjNZf7oAqx7NOHviEZCsPMvwtv4DGGHtbs.js:147:26)
- 🇺🇸United States dmudie
I edited my test to get rid of 'leaflet_map_get_info' and called from the service instead:
$gmap = \Drupal::service('leaflet.service')->leafletMapGetInfo('mymodule_map');
However, same result. No points on the map.
Inspecting the returned arrays of the doesn't reveal anything to me either:
This works:array:4 [▼ "label" => "OSM Mapnik" "description" => TranslatableMarkup {#420 ▼ #string: "Leaflet default map." #arguments: [] #translatedMarkup: null #options: [] #stringTranslation: null } "settings" => array:11 [▼ "dragging" => true "touchZoom" => true "scrollWheelZoom" => true "doubleClickZoom" => true "zoomControl" => true "zoomControlPosition" => "topleft" "attributionControl" => true "trackResize" => true "fadeAnimation" => true "zoomAnimation" => true "closePopupOnClick" => true ] "layers" => array:1 [▼ "earth" => array:2 [▼ "urlTemplate" => "//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" "options" => array:1 [▶] ] ] ]
This does not:
array:5 [▼ "label" => "Mymap" "description" => TranslatableMarkup {#401 ▼ #string: "This is the custom map style." #arguments: [] #translatedMarkup: null #options: [] #stringTranslation: null } "settings" => array:15 [▼ "dragging" => true "touchZoom" => true "scrollWheelZoom" => true "doubleClickZoom" => true "zoomControl" => true "attributionControl" => true "trackResize" => true "fadeAnimation" => true "zoomAnimation" => true "closePopupOnClick" => true "minZoom" => 1 "maxZoom" => 18 "zoom" => 2 "layerControl" => true "layerControlOptions" => array:1 [▼ "position" => "topright" ] ] "layers" => array:1 [▼ "layer" => array:4 [▼ "type" => "sat" "ext" => "jpg" "urlTemplate" => "//server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}" "options" => array:2 [▶] ] ] "plugins" => [] ]
- Status changed to Needs review
over 1 year ago 8:42am 24 June 2023 - 🇮🇹Italy itamair
Inspected this, sincerely didn't find big issues but only a mino fix related to this: https://www.drupal.org/project/leaflet/issues/3368373 🐛 Conflict between Scale and Geocoder controls in last Leaflet release Fixed
Please check last 10.0.15 release that probably might fix also this one.
- 🇺🇸United States dmudie
The problem persists on 10.0.15. Still no points loading on a map configured with mymodule_leaflet_map_info in a custom module.
- 🇩🇪Germany cbeier
I had the same error and after some debugging, I have the cause (at least for me).
In my settings array for Leaflet, the key "zoomControlPosition" was missing.
$leaflet_map_settings = [ 'dragging' => TRUE, 'touchZoom' => TRUE, 'scrollWheelZoom' => FALSE, 'doubleClickZoom' => TRUE, 'zoomControl' => TRUE, 'zoomControlPosition' => 'topleft', // <-- Important 'attributionControl' => TRUE, 'trackResize' => TRUE, 'fadeAnimation' => TRUE, 'zoomAnimation' => TRUE, 'closePopupOnClick' => TRUE, 'map_position_force' => FALSE, ... ]
- First commit to issue fork.
- 🇮🇹Italy itamair
thanks @cbeier ... indeed your catch looks the proper fix to this issue.
Let's wait confirmation from the @dmudie - 🇮🇹Italy apaderno Brescia, 🇮🇹
I am removing the credit automatically given for an empty issue fork. I apologize for bumping this issue.
- 🇺🇸United States dmudie
Thank you @cbeier! I can confirm that map points do render now with a ZoomControl Position defined. I appreciate the help.
- Status changed to Fixed
over 1 year ago 8:31pm 3 July 2023 Automatically closed - issue fixed for 2 weeks with no activity.