Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48983

When searching for layer features in map, the coordinates returns empty

$
0
0

When I try to search layer features in OL map using layer.getSource().getFeatures() through a button event, the features returns with their coordinates empty and with an infinity extent:

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

This layer contains Linestring features, but when I tried to make the same thing with another layer, this time with Pointgeometry, the coordinates returned with right values, as expected. This problem only happens with the LineString layer.

I’ve already tried to use a Promise to wait the population of variables, I also tried to use if (layer.getSource().getState() === 'ready') to check the state of function before executing.

All the features are loaded through storage and are created on map, which returns with the right coordinates. If I try to obtain the data of this features after loading it, I can observe the data of the coordinates perfectly. The problem is on the call of the event, which also are fired after the feature loading.

At the moment the code of acquisition of features is:

this.exportFeaturesSubscription = this.datashare.exportFeaturesObservable().subscribe(element => {
    // Get array of features
    let points = this.vectorPoint.getSource().getFeatures(); // Return with correct coordinates
    let lines = this.pathsLayer.getSource().getFeatures(); // Return with empty coordinates
});

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48983

Trending Articles



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