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

ResourceProvider: Add support to filter ResourceSet features #1838

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

panaaj
Copy link
Member

@panaaj panaaj commented Nov 30, 2024

Background

Resources defined in the Signal K specification support only one GeoJSON feature per resource entry i.e.

  • Waypoints = a single Point feature
  • Routes = a single LineString feature
  • Regions = a single Polygon feature

To enable the use of more than one feature per resource entry Freeboard-SK supports the use of ResourceSets.
ResourceSets employ GeoJSON FeatureCollections to allow the definition of multiple features of varied geometry types.

Issue

When providing a filter to a resource request, the operation only supports single feature resource types (e.g. waypoints, routes) so when the request is targeting a ResourceSet, it's features are not correctly processed and an empty result is returned.
e.g. /signalk/v2/api/resources/<my_resource_type>?position=[109.5711467220878,-9.33075032178624]&distance=185200

Noting that a ResourceSet is not currently part of the Signal K specification, there is an opportunity to define and formalise a JSON schema to support a resource entry containing more than one feature.

Implementation

This PR adds the necessary support to filter features in a ResourceSet and return only those that match the query based on the current ResourceSet definition.
If no features match then the ResourceSet is returned with an empty feature array.

{
    "name": "My resource Set 1",
    "description": "My set of resources.",
    "type": "ResourceSet",
    "styles": {},
    "values": {
      "type": "FeatureCollection",
      "features": []
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant