diff --git a/plugins/tiddlywiki/geospatial/tests/widgets/geomap-empty-layer.tid b/plugins/tiddlywiki/geospatial/tests/widgets/geomap-empty-layer.tid new file mode 100644 index 000000000..1a8cdb686 --- /dev/null +++ b/plugins/tiddlywiki/geospatial/tests/widgets/geomap-empty-layer.tid @@ -0,0 +1,19 @@ +title: $:/plugins/tiddlywiki/geospatial/tests/widgets/geomap-empty-layer +description: Map using geolayer without json and lat/long attributes +import: $:/plugins/tiddlywiki/geospatial +type: text/vnd.tiddlywiki-multiple +tags: [[$:/tags/wiki-test-spec]] + +title: Narrative + +Verify exception reported in [[8452|https://github.com/TiddlyWiki/TiddlyWiki5/issues/8452]] is not thrown when the geolayer widget has no attributes ++ +title: Output + +<$geomap startPosition="bounds"> +<$geolayer/> + ++ +title: ExpectedResult + +

\ No newline at end of file diff --git a/plugins/tiddlywiki/geospatial/widgets/geomap.js b/plugins/tiddlywiki/geospatial/widgets/geomap.js index 9d9dfccd6..ba2957db2 100644 --- a/plugins/tiddlywiki/geospatial/widgets/geomap.js +++ b/plugins/tiddlywiki/geospatial/widgets/geomap.js @@ -262,10 +262,12 @@ GeomapWidget.prototype.refreshMap = function() { var bounds = null; $tw.utils.each(this.renderedLayers,function(layer) { var featureBounds = layer.layer.getBounds(); - if(bounds) { - bounds.extend(featureBounds); - } else { - bounds = featureBounds; + if(featureBounds.isValid()) { + if(bounds) { + bounds.extend(featureBounds); + } else { + bounds = featureBounds; + } } }); if(bounds) {