Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to implement filtering using point + range #820

Open
lvdbrink opened this issue Apr 14, 2023 · 3 comments
Open

How to implement filtering using point + range #820

lvdbrink opened this issue Apr 14, 2023 · 3 comments
Labels
CQL2 Future work support in an additional part of OGC API Features

Comments

@lvdbrink
Copy link

I couldn't find this in the spec (part 1 or 3) or in an earlier issue, apologies if I overlooked something.

Is there a way to implement a filter where the client sends a POINT geometry in the request and the server returns all features within a certain range of this POINT? The range could be e.g. a kilometer, in the case I'm asking about this is fixed on the server, the client cannot ask for a specific range.

It seems to me this is a common thing for users to want. Quoting the SDW-BP:

Support queries for Spatial Things based on user needs. For spatial data, typical needs that should be considered are neighborhood searches (e.g., "what is near me?" or "what is near this Spatial Thing?")

@cportele
Copy link
Member

There is currently no standardized way for such a query. The server would have to provide a CQL2 buffer function.

Of course, the client could also create a polygon that approximates a circle, but this wouldn't work for the use case.

If the range is fixed, a specific function that just takes a point might be the right approach anyway. Or maybe a custom query parameter.

We restricted CQL2 to the spatial predicates in the first version, functions that compute geometries will likely be added in the future in a new conformance class, also to support non-boolean expressions.

@cportele cportele added the CQL2 label Apr 14, 2023
@cportele cportele added the Future work support in an additional part of OGC API Features label Apr 24, 2023
@cportele
Copy link
Member

Meeting 2023-04-24: This could be implemented in an extension or in a future version.

@jerstlouis
Copy link
Member

A distance() function that returns the distance between two geometries (including a POINT() supplied as part of the CQL2 expression) could be another approach.
Unlike buffer(), this approach does not require instantiating a new geometry, so depending on optimizations, it might perform slightly better.

In symbolization, the resulting value could also be used to illustrate this distance with a gradient / colormap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CQL2 Future work support in an additional part of OGC API Features
Development

No branches or pull requests

3 participants