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

Arcgis sink. Set geometry to null when location is null #2379

Closed
danielvillalbamota opened this issue Jun 6, 2024 · 3 comments
Closed

Arcgis sink. Set geometry to null when location is null #2379

danielvillalbamota opened this issue Jun 6, 2024 · 3 comments

Comments

@danielvillalbamota
Copy link
Collaborator

Problem

Arcgis sink is setting geometry to {"x":0.0,"y":0.0,"spatialReference":{"wkid":4326} when location has null value.

The following extract of traces show the case:

time=2024-06-06T14:35:08.843Z | lvl=DEBUG | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=contextAttrToFeature | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink$NGSIArcgisAggregator[547] : [NGSIArcgisAggregator-contextAttrToFeature] Processing Attribute: {"name":"location","type":"geo:json","value":null,"metadatas":[]}
time=2024-06-06T14:35:08.843Z | lvl=DEBUG | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=contextAttrToFeature | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink$NGSIArcgisAggregator[555] : [NGSIArcgisAggregator] aggregate - Atribute (name --> location, type --> geo:json, value --> null, metadata= ignored )
time=2024-06-06T14:35:08.843Z | lvl=DEBUG | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=contextAttrToFeature | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink$NGSIArcgisAggregator[559] : Proccessing attribute value:  location --> null
time=2024-06-06T14:35:08.843Z | lvl=DEBUG | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=jsonElementToFeatureAttr | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink[579] : Proccessing attribute value:  location --> null
time=2024-06-06T14:35:08.843Z | lvl=ERROR | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=jsonElementToFeatureAttr | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink[601] : Invalid geo:json format, (sikipped): null - Error: Not a JSON Object: null
.
.
.
time=2024-06-06T14:35:08.927Z | lvl=DEBUG | corr=85012c85-8cbf-451d-9144; cbnotif=1 | trans=36a49336-6ea7-4b4d-91d4 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=requestHTTP | msg=com.telefonica.iot.cygnus.backends.arcgis.restutils.RestApi[179] : requesting HTTP: https://arcgis_server/server/rest/services/OP/OP_Plataform/FeatureServer/157/updateFeatures?outSR=%7B%22wkid%22%3A4326%7D&token=0RYQ...&rollbackOnFailure=true---METHOD: POST---BODY: features=%5B%7B%22geometry%22%3A%7B%22x%22%3A0.0%2C%22y%22%3A0.0%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D%2C%22attributes%22%3A%7B%22OBJECTID%22%3A5%2C%22fiwareid%22%3A%22W01%22%2C%22humedad_relativa%22%3A53%2C%22nombre%22%3A%22ESTACI%C3%93N%22%7D%7D%5D&f=json

The POST query to Arcgis has the following BODY:
features=[{"geometry":{"x":0.0,"y":0.0,"spatialReference":{"wkid":4326}},"attributes":{"OBJECTID":5,"fiwareid":"W01","humedad_relativa":53,"nombre":"ESTACIÓN"}}]&f=json

Where the sink is setting "geometry" to {"x":0.0,"y":0.0,"spatialReference":{"wkid":4326}} instead of setting null value.

Expected behavior

Arcgis sink should set "geometry" to null to avoid overwriting previous values in the geometry's feature or writing a non correct geometry for a feature that has no geometry.

Following the previous example, the BODY of the query should be:

features=[{"geometry": null,"attributes":{"OBJECTID":5,"fiwareid":"W01","humedad_relativa":53,"nombre":"ESTACIÓN"}}]&f=json

@AlvaroVega
Copy link
Member

Entidad with
{ "name":"location","type":"geo:json","value":null,"metadatas":[]}

Arrives to sink and is

time=2024-06-07T06:34:33.455Z | lvl=DEBUG | corr=04bfb3fe-f99d-4e8f-8cf4-5aa44b20f487; cbnotif=1 | trans=cf1de6e9-c5e3-4b7e-a72b-45c25e291211 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=contextAttrToFeature | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink$NGSIArcgisAggregator[555] : [NGSIArcgisAggregator] aggregate - Atribute (name --> location, type --> geo:json, value --> null, metadata= ignored )
time=2024-06-07T06:34:33.455Z | lvl=DEBUG | corr=04bfb3fe-f99d-4e8f-8cf4-5aa44b20f487; cbnotif=1 | trans=cf1de6e9-c5e3-4b7e-a72b-45c25e291211 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=contextAttrToFeature | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink$NGSIArcgisAggregator[559] : Proccessing attribute value: location --> null

And is refused to invalid geo:json format:

time=2024-06-07T06:34:33.455Z | lvl=DEBUG | corr=04bfb3fe-f99d-4e8f-8cf4-5aa44b20f487; cbnotif=1 | trans=cf1de6e9-c5e3-4b7e-a72b-45c25e291211 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=jsonElementToFeatureAttr | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink[579] : Proccessing attribute value: location --> null
time=2024-06-07T06:34:33.455Z | lvl=ERROR | corr=04bfb3fe-f99d-4e8f-8cf4-5aa44b20f487; cbnotif=1 | trans=cf1de6e9-c5e3-4b7e-a72b-45c25e291211 | srv=N/A | subsrv=N/A | comp=cygnus-ngsi | op=jsonElementToFeatureAttr | msg=com.telefonica.iot.cygnus.sinks.NGSIArcgisFeatureTableSink[601] : Invalid geo:json format, (sikipped): null - Error: Not a JSON Object: null

@fgalan
Copy link
Member

fgalan commented Jun 7, 2024

PR #2380

Pending on @danielvillalbamota validation before closing this issue.

@danielvillalbamota
Copy link
Collaborator Author

It works. I close the issue

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

No branches or pull requests

3 participants