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

enclosure addition in feature collection links #230

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

tanvi029
Copy link
Collaborator

@tanvi029 tanvi029 commented Dec 17, 2024

  • Added link to OGC features /collections/ and /collections
  • Created migration for table collections_enclosure
  • Modified /stac/collections/ to display those collections that have collection_type as STAC
  • Updated the OGC spec to include those collections in /api which are not of type STAC and in /stac/api to include collection of type STAC
  • modified the STAC spec to include endpoint /stac/collections//items

@tanvi029
Copy link
Collaborator Author

retest this please

@tanvi029 tanvi029 requested a review from code-akki December 18, 2024 04:24
if (success.isEmpty()) {
LOGGER.error("Collections table is empty!");
result.fail(
new OgcException(404, "Not found", "Collection table is Empty!"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot throw a 404 exception here because /collections is a valid path. If the table is empty just return an empty response or a JsonObject for collections object.

if (successItem
.getString("id")
.equals(enclosure.getString("collections_id"))) {
if (successItem.containsKey("enclosure")) {
Copy link
Collaborator

@code-akki code-akki Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is the successItem having the enclosure key beforehand?

LOGGER.warn("Assets table is empty!");
result.complete(success);
} else {
for (JsonObject enclosure : enclosureResult) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of running a double for loop, what you can try and verify is to change the query itself to join the table collections_enclosure and use json_agg(), refer-

", jsonb_agg((row_to_json(stac_items_assets.*)::jsonb - 'item_id')) as assetobjects" +


INSERT INTO collections_enclosure (id, collections_id, title, href, type, size)
SELECT id, stac_collections_id, title, href, type, size
FROM stac_collections_assets;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a truncate statement to the stac_collections_assets table since all the data will now be moved to a new table and all existing rows won't have any relation with the new data that will added in the future.

"SELECT collections_details.id, title, "
+ "description, bbox, temporal, license FROM collections_details "
+ "JOIN collection_type ON collections_details.id = collection_type.collection_id "
+ "WHERE collection_type.type = 'STAC' AND collections_details.id = $1::uuid GROUP "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you require a GROUP BY clause?

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

Successfully merging this pull request may close these issues.

2 participants