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

Harmony 2001 #693

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

Harmony 2001 #693

wants to merge 4 commits into from

Conversation

indiejames
Copy link
Contributor

@indiejames indiejames commented Feb 6, 2025

Jira Issue ID

HARMONY-2001

Description

Converts Points and MultiPoints in geojson files to Polygons and MultiPolygons respectively. This fixes a bug where Harmony was attempting to split Points on the antimeridian as part of geojson normalization, but failing because the underlying splitter library doesn't support Points. This change supports Points and MultiPoints that add a radius as well, which EDSC is sending in some cases.

Also snuck in a fix to delete krelay processes when stopping Harmony.

Local Test Steps

Issue a POST request to UAT with the following shapefile

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          -118.2832,
          34.03321
        ]
      },
      "properties": {
        "radius": 136593
      }
    }
  ],
  "properties": {
    "summary": "Shapefile created by Earthdata Search to support spatial subsetting when requesting data from Harmony."
  }
}

e.g.,

curl -Ln -bj --request POST \
  --url 'https://harmony.uat.earthdata.nasa.gov/C1238544384-EEDTEST/ogc-api-coverages/1.0.0/collections/all/coverage/rangeset/?=' \
  --header 'Content-Type: multipart/form-data' \
  --header "Authorization:Bearer $MY_UAT_TOKEN" \
  --form "shapefile=@/Users/jnorton1/Downloads/pointWithRadius.geojson;type=application/geo+json" \
  --form maxResults=1

with multipart form parameters shapefile and maxResults.
The request will fail with an error about attempting to convert the provided shapefile.

Now issue the same request to localhost (after starting with this branch).
You should see the request run and create a job. Don't worry about whether or not you have the correct service deployed, this is just to verify that the shapefile normalization handles the geojson.

I have visually inspected the output of the circle polygon generation and it looks right to me. If you want to see this you can just log the output of normalization in one of the new tests and plot that in a geojson viewer like this one https://geojson.tools/.

PR Acceptance Checklist

  • Acceptance criteria met
  • Tests added/updated (if needed) and passing
  • Documentation updated (if needed)
  • Harmony in a Box tested? (if changes made to microservices)

Copy link
Contributor

@chris-durbin chris-durbin left a comment

Choose a reason for hiding this comment

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

The changes look good - since we added some dependencies we'll want to test harmony in a box to make sure none of the microservices need to add the libraries as well (since they pull in code from services/harmony it isn't obvious when the libraries will have to be pulled in).

* @param pnt - geojson Point for the center of the circle
* @returns a geojson polygon
*/
function pointToPolygon(pnt: Feature<Point>): Feature<Polygon, {}> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just FYI that we'll want to do something similar for the EDR radius function in the future - https://opengeospatial.github.io/e-learning/ogcapi-edr/text/radiusquery.html

Copy link
Contributor

@chris-durbin chris-durbin left a comment

Choose a reason for hiding this comment

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

I tested the shapefile from the description. In UAT it returns an error for the shapefile, but locally on this branch my request is submitted successfully.

Harmony in a box failed for query-cmr, work-failer, and work-updater due to missing dependencies (the turf libraries that were added to the main harmony service also need included in those services). Once harmony in a box is working I am good with merging in this PR.

@indiejames
Copy link
Contributor Author

I tested the shapefile from the description. In UAT it returns an error for the shapefile, but locally on this branch my request is submitted successfully.

Harmony in a box failed for query-cmr, work-failer, and work-updater due to missing dependencies (the turf libraries that were added to the main harmony service also need included in those services). Once harmony in a box is working I am good with merging in this PR.

Fixed

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.

3 participants