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

fullGeoJson flag for Feature and FeatureCollection attributes #4125

Open
fgalan opened this issue May 18, 2022 · 3 comments
Open

fullGeoJson flag for Feature and FeatureCollection attributes #4125

fgalan opened this issue May 18, 2022 · 3 comments

Comments

@fgalan
Copy link
Member

fgalan commented May 18, 2022

After some internal discussion, we have decided that the processing of Feature and FeatureCollection geo:json attributes (issue #4114) will involve a normalization in GET/notification stage. That is, CB will accept the Feature and FeatureCollection format in attribute creating/update but in attribute GET/notification only the geometry will be returned.

This involves a lost of information in the attribute being created/update (in particular, the properties field associate to the Feature). For current use case, that information is not needed, but maybe it is needed in the future. Thus:

  1. At the present moment, CB stores in DB the attribute Feature/FeatureCollection value as it was created/updated
  2. A new option flag will be developed to specify that the user want the full Feature or FeatureCollection representation. In particular:
    • A new option for GET, eg. ?options=fullGeoJson
    • A new boolean field for subscriptions, e.g. "fullGeoJson": true|false
  3. The default mode will be as we have now (version 3.7.0), to ensure backward compatibility. That is, not returning full Geo JSON
@fgalan
Copy link
Member Author

fgalan commented May 18, 2022

A new option for GET, eg. ?options=fullGeoJson

The following .test files (pay attention at commit hash) can be useful when implementing that:

https://github.com/telefonicaid/fiware-orion/tree/3cc7ff753c0b24a953e79b22ff57032b960f579e/test/functionalTest/cases/4114_geojson_feature_support

(The correspond to a version of the code when we think that the "full GeoJSON mode" were what we need)

@fgalan
Copy link
Member Author

fgalan commented May 18, 2022

Documentation doc/manuals/user/ngsiv2_implementation_notes.md has a paragrah:

Note that actually Orion stores the full value used at Feature or FeatureCollection
creation/updating time. However, from the point of view of normalization with other geo:json types,
it has been decided to return only the geometry part. In the future, maybe a flag to return
the full content would be implemented (more detail in this issue).

That would need to be adapted upon fixing of this issue.

@fgalan
Copy link
Member Author

fgalan commented May 18, 2022

Implementation notes:

In ContextAttribute::toJson() this is the key part:

  if (compoundValueP != NULL)
  {
    orion::CompoundValueNode* childToRenderP = compoundValueP;
    if (type == GEO_JSON)
    {
      childToRenderP = getGeometry(compoundValueP);
    }

    // Some internal error conditions in getGeometryToRender() (e.g. out of band manipulation
    // of DB entities) may lead to NULL, so the check is needed
    if (childToRenderP != NULL)
    {
      jh.addRaw("value", childToRenderP->toJson());
    }
  }

The new flag has to be taken into account in if (type == GEO_JSON) so getGeometry() doesn't get invoked if full GeoJSON is requested.

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

No branches or pull requests

1 participant