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

DDF-4652 Add coordinate order handling to HandlebarsWfsFeatureTransfo… #4654

Merged
merged 1 commit into from
May 2, 2019

Conversation

jrnorth
Copy link
Contributor

@jrnorth jrnorth commented Apr 8, 2019

What does this PR do?

Previously, HandlebarsWfsFeatureTransformer would always reverse the coordinate order of every spatial feature when transforming them to WKT strings even if the coordinates were already in lon/lat order.

This commit adds the ability to configure each HandlebarsWfsFeatureTransformer's feature coordinate order, that is, the coordinate order of its corresponding feature's spatial properties. The coordinate order will only be reversed if the feature coordinate order is lat/lon, since DDF expects WKT strings to be in lon/lat order.

Who is reviewing it?

@dcruver
@leo-sakh
@samuelechu
@brianfelix

Select relevant component teams:

@codice/io

Ask 2 committers to review/merge the PR and tag them here.

@bdeining
@troymohl

How should this be tested?

  1. In the Admin UI, open the Spatial app.
  2. Click WFS Feature to Metacard Templated Mapping.
    a. For Feature Type, enter {http://stategeothermaldata.org/uri-gin/aasg/xmlschema/welllog/0.8}WellLog
    b. Set the Coordinate Order to Lat/Lon.
    c. Add the following to Attribute Mappings: {"attributeName":"location","featureName":"Shape","template":"{{Shape}}"} and {"attributeName":"title","featureName":"DisplayName","template":"{{DisplayName}}"}
    d. Click Save changes.
  3. Create a WFS 1.1.0 source with the URL http://services.azgs.az.gov/ArcGIS/services/aasggeothermal/CAWellLogs/MapServer/WFSServer
    a. Disable the CN check and allow redirects. Leave everything else as-is.
  4. Open Intrigue, remove the 3D map and add the 2D map.
  5. Run a query for ext.WellLog.LatDegree > 0.
  6. Verify you receive results and they appear in California.
  7. Go back to WFS Feature to Metacard Templated Mapping in the Admin UI, change the coordinate order to Lon/Lat and save the changes.
  8. Run the same query in Intrigue and verify you still receive results but they appear outside the map bounds on the bottom.
  9. Change the coordinate order back to Lat/Lon, rerun the query, and verify the results appear in California again.

Any background context you want to provide?

What are the relevant tickets?

Fixes: #4652

Checklist:

  • Documentation Updated
  • Update / Add Threat Dragon models
  • Update / Add Unit Tests
  • Update / Add Integration Tests

Notes on Review Process

Please see Notes on Review Process for further guidance on requirements for merging and abbreviated reviews.

Review Comment Legend:

  • ✏️ (Pencil) This comment is a nitpick or style suggestion, no action required for approval. This comment should provide a suggestion either as an in line code snippet or a gist.
  • ❓ (Question Mark) This comment is to gain a clearer understanding of design or code choices, clarification is required but action may not be necessary for approval.
  • ❗ (Exclamation Mark) This comment is critical and requires clarification or action before approval.

@@ -309,7 +308,6 @@ private void readGmlData(
}
} finally {
eventWriter.close();
IOUtils.closeQuietly(stringWriter);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed because closing a StringWriter has no effect.

@@ -230,7 +230,6 @@ private String getNamespaceAlias(String namespace, Map<String, String> namespace
private String getIdAttributeValue(
StartElement startElement, Map<String, String> namespaces, String namespaceAlias) {
String id = null;
startElement.getAttributeByName(new QName(namespaces.get(namespaceAlias), "id")).getValue();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed because the getValue() call can cause a NullPointerException when the element has no gml:id attribute. And this statement appears to serve no purpose.

@bdeining
Copy link
Member

bdeining commented May 1, 2019

@jrnorth this one could use a rebase

…rmer

Previously, HandlebarsWfsFeatureTransformer would always reverse the
coordinate order of every spatial feature when transforming them to WKT
strings even if the coordinates were already in lon/lat order.

This commit adds the ability to configure each
HandlebarsWfsFeatureTransformer's feature coordinate order, that is, the
coordinate order of its corresponding feature's spatial properties. The
coordinate order will only be reversed if the feature coordinate order
is lat/lon, since DDF expects WKT strings to be in lon/lat order.
@jrnorth jrnorth force-pushed the wfs-handlebars-coordinate-order branch from 6cb3336 to 22359fc Compare May 1, 2019 16:37
@jrnorth
Copy link
Contributor Author

jrnorth commented May 1, 2019

build now

@cxbot
Copy link

cxbot commented May 1, 2019

Internal build has been scheduled, your results will be available at build completion.

@cxbot
Copy link

cxbot commented May 2, 2019

Refer to this link for build results (access rights to CI server needed):
https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/6646/

Build result: ABORTED

[...truncated 5.04 MB...][WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: java.util.concurrent.ExecutionException: Invalid object ID 167 iota=552[WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: java.util.concurrent.ExecutionException: Invalid object ID 341 iota=552[INFO] [INFO] ------------------------------------------------------------------------[INFO] Building DDF :: Distribution :: Docker :: DDF 2.15.0-SNAPSHOT[INFO] ------------------------------------------------------------------------������[INFO] [INFO] --- fmt-maven-plugin:2.3.0:check (default) @ ddf ---[warn] Source directory '/jenkins/workspace/DDF-Jobs/pr/Linux/distribution/docker/ddf/src/main/java' does not exist, ignoring.[warn] Test source directory '/jenkins/workspace/DDF-Jobs/pr/Linux/distribution/docker/ddf/src/test/java' does not exist, ignoring.[INFO] Processed 0 files (0 non-complying). [] [WARNING] Failed to notify spy hudson.maven.Maven3Builder$JenkinsEventSpy: java.util.concurrent.ExecutionException: Invalid object ID 341 iota=552[INFO] [INFO] --- maven-checkstyle-plugin:3.0.0:check (checkstyle-check) @ ddf ---Set build name.channel stoppedNew build name is 'PR 4654'Taking single-use slave mesos-jenkins-95edcf1fad034e0bb26f4db04d68eaa9-linux-large offline.Build was abortedArchiving artifactsAdding one-line test results to commit status...Setting status of 22359fc to FAILURE with url https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/6646/ and message: 'JOB FAILURE: https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/6646/ 24 tests run, 0 skipped, 0 failed.'Using context: Internal CI Pipeline
❌ JOB FAILURE

@bdeining
Copy link
Member

bdeining commented May 2, 2019

build now

@cxbot
Copy link

cxbot commented May 2, 2019

Internal build has been scheduled, your results will be available at build completion.

@bdeining
Copy link
Member

bdeining commented May 2, 2019

verified coordinate order functionality in WFS Feature to Metacard Templated Mapping

@cxbot
Copy link

cxbot commented May 2, 2019

Refer to this link for build results (access rights to CI server needed):
https://jenkins.codice.org/job/DDF-Jobs/job/pr/job/Linux/6655/
✅ JOB SUCCESS

@bdeining bdeining merged commit 9507674 into codice:master May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Handlebars WFS feature transformer should support both lat/lon and lon/lat coordinate orders
8 participants