I have a feature created from Well Known Text as following:

var feature = format.readFeature(wkt , {
    dataProjection: 'EPSG:25830',
    featureProjection: 'EPSG:25830'

When I add it to a layer and try to center in the map like this:

this.map.getView().fit(feature.values_.geometry.extent_, {duration: 2500}); 

I get an AssertionError. When analyzing the feature I find the extent is set to infinity:

extent_: (4) [Infinity, Infinity, -Infinity, -Infinity]

How can I calculate the feature extent? How can I zoom and center the created feature on the map?

1 Answer 1


The solution was pretty simple:

Just replacing




That worked fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.