Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

OpenLayer: Extent of KML lost and turned to [Infinity, Infinity, -Infinity, -Infinity]?

$
0
0

I am trying to retrieve the extent of a KML layer I am bringing into OpenLayer.

When I open the KML layer in QGIS, I see there is extent information attached to it that I would like to use inside OpenLayer.

enter image description here

(Note: that extent information is "correct" => matches my expectations)

But when I load the layer in my script using VectorSource and format: new KML(), it seems as though the extent information is lost and turned into [Infinity, Infinity, -Infinity, -Infinity].

import VectorSource from "ol/source/Vector.js";import KML from "ol/format/KML.js";const model = new VectorSource({      url: ".....",      format: new KML(),    });console.log("model");console.log(model);console.log("model.getExtent()");console.log(model.getExtent());

enter image description here

My question: Is there a way to programmatically retrieve the extent information I see in QGIS directly from within my OpenLayer script (by reading a property of the imported object rather than copy pasting manually from QGIS or some other data-source)?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>