TransWikia.com

How to remove features out of the extent?

Geographic Information Systems Asked on November 1, 2021

I am using openlayers tile strategy and custom load function.

this.source = new Vector({
  format: new EsriJSON(),
  strategy: tile(createXYZ({tileSize: 512})),
  loader: (extent: any, resolution: any, projection: any) => {
        
        let source = layer.getSource();
                  
        this.http.get(url, this.httpOptions).subscribe(
            (response: any) => {                   

                source.addFeatures(
                    source.getFormat().readFeatures(response)
                );
            },
            (error: any) => {                    
                console.error(error);
            }
        );
    }
});

But the features are icreasing in source while zooming in or out. So I want to remove features that out of the current extent from source after add. How can I do it?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP