getodk / central-backend

Node.js based backend for ODK Central
https://docs.getodk.org/central-intro/
Apache License 2.0
50 stars 75 forks source link

Wrong property type for LineString in OData metadata API #321

Closed larshelge closed 3 years ago

larshelge commented 3 years ago

This issue is about the OData API for ODK Central and how LineString properties are rendered.

Geo trace input fields (widgets) in an ODK form allow you to capture a line string as part of a submission.

When rendering the geo trace widget in the OData metadata API endpoint, the geo trace property type is set to Edm.String. According to the docs, the Edm.GeographyLineString is supported. I believe geo trace widgets should be rendered as Edm.GeographyLineString in this case.

When accessing the submission data through Apache Olingo, for geo trace data, the data is rendered with type LineString similar to this:

"geotrace_widget": {
    "type": "LineString",
    "coordinates": [
        [
            13.053503,
            58.251077,
            0
        ],
        [
            13.056146,
            58.253019,
            0
        ]
    ]
}

Example URL:

https://trial.getodk.cloud/v1/projects/{project-id}/forms/all-widgets.svc/Submissions

Correspondingly in the metadata endpoint, this property is rendered like this:

<Property Name="geotrace_widget" Type="Edm.String"/>

Note the mismatch between the Edm.String type in the metadata response and the LineString type in the data submission response.

Example URL:

https://trial.getodk.cloud/v1/projects/{project-id}/forms/all-widgets.svc/$metadata

In libraries like Apache Lingo, the values are rendered as org.apache.olingo.commons.api.edm.geo.LineString class type.

There appears to be a mismatch here, where geo trace widgets should have type Edm.GeographyLineString instead of String.

I suspect it will be similar for polygons. Points are rendered correctly.

Steps to reproduce

matthew-white commented 3 years ago

Thanks, @larshelge! I think this may have been fixed in 632c42f7d94a6b21cd94a444c845838776aa7f99, which we released with v1.1 last week. What version of ODK Central are you using?

I also wanted to link to #294, which I think is a different but related issue.

larshelge commented 3 years ago

Thanks, sounds good @matthew-white . I am using https://trial.getodk.cloud/ i.e. the trial space of the hosted version. I am not quite sure which version that maps to.

My long-shot guess is that #294 is related to #322.

issa-tseng commented 3 years ago

likely both this issue as well as #322 are/were issues. i am going to close this one for now as i concur this should be fixed by v1.1. please reopen if this is not the case.

larshelge commented 3 years ago

Okay thanks @issa-tseng . Would it be useful to wait until the fix is deployed and verified before closing the issue? Do you know when the fix will be deployed to the hosted environment?

yanokwa commented 3 years ago

@larshelge The fix has just been deployed to https://trial.getodk.cloud. Try now and email me if it's still failing.

yanokwa commented 3 years ago

Oh, you can also, and maybe this is better, comment on the issue so others can benefit.

larshelge commented 3 years ago

Great, thanks @yanokwa . I tested again and can confirm it works as expected. Thanks for the fix!