Skip to content
rinzeb edited this page Jul 21, 2015 · 1 revision

Area filters

Currently csWeb implements two ways of filtering features based on their location. The first allows you to select a rectangular region of interest, the other lets you choose an existing polygon to use as filter.

Draggable filter

To activate the draggable filter, click on the filter icon in the left panel. In the left tab that appears, click on "Enable location filter". A highlighted rectangle appears, which can be resized and moved to select the desired area of interest. All active features of the current project outside the region will be filtered out.

Area filter

Polygon filter

To use the polygon filter, a layer containing polygons should be enabled. Right-clicking a polygon will show a context menu, with the option to select the current polygon as filter.

Polygon filter

Code implementation

To implement the polygon filter in your project, open the file 'public/app.ts'. In the class definition, add a AreaFilterModel: public areaFilter: AreaFilter.AreaFilterModel;

Also make sure that the AreaFilterModel is initialized and registered when the project is loaded:

    $messageBusService.subscribe("project", (action: string) => {
        if (action === "loaded") {
            this.areaFilter = new AreaFilter.AreaFilterModel();
            this.$layerService.addActionService(this.areaFilter);
        }
    });

Finally, add the locationfilter.js to the index.html by adding the line: <script src="cs/js/locationfilter.js"></script>