Skip to content

Commit

Permalink
Allow filtering geoshape fields around map extent (#452)
Browse files Browse the repository at this point in the history
From 2.9, geoshape supports geo bounding box. Hence, remove
the constraint that disables geo bounding box for non geopoint
fields.

Signed-off-by: Vijayan Balasubramanian <[email protected]>
  • Loading branch information
VijayanB authored Aug 6, 2023
1 parent 57c225a commit a4e92a0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Maintenance
### Refactoring

## [Unreleased 2.x](https://github.com/opensearch-project/dashboards-maps/compare/2.8...2.x)
## [Unreleased 2.x](https://github.com/opensearch-project/dashboards-maps/compare/2.9...2.x)
### Features
* Allow filtering geo_shape fields around map extent ([#452](https://github.com/opensearch-project/dashboards-maps/pull/452))

### Enhancements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ export const DocumentLayerSource = ({
<EuiFormRow>
<EuiCheckbox
id={`${selectedLayerConfig.id}-bounding-box-filter`}
disabled={selectedLayerConfig.source.geoFieldType !== 'geo_point'}
label={'Only request data around map extent'}
checked={selectedLayerConfig.source.useGeoBoundingBoxFilter ? true : false}
onChange={onToggleGeoBoundingBox}
Expand Down
3 changes: 1 addition & 2 deletions public/model/layerRenderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ const getGeoBoundingBoxFilter = (
maplibreRef: MaplibreRef
): GeoBoundingBoxFilter => {
const geoField = mapLayer.source.geoFieldName;
const geoFieldType = mapLayer.source.geoFieldType;

// geo bounding box query supports geo_point fields
const mapBounds: GeoBounds = getBounds(maplibreRef.current!);
const meta: FilterMeta = {
alias: null,
disabled: !mapLayer.source.useGeoBoundingBoxFilter || geoFieldType !== 'geo_point',
disabled: !mapLayer.source.useGeoBoundingBoxFilter,
negate: false,
type: FILTERS.GEO_BOUNDING_BOX,
};
Expand Down

0 comments on commit a4e92a0

Please sign in to comment.