Skip to content

Commit

Permalink
Merge pull request #2380 from telefonicaid/task/set_geometry_null_val…
Browse files Browse the repository at this point in the history
…ue_when_invalid_format

force null geometry when invalid geo:json format or type found
  • Loading branch information
fgalan authored Jun 7, 2024
2 parents 9c9657c + 11ed530 commit 22c6c24
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- [cygnus-arcgis] Insert null attribute as is in feature table (#2376)
- [cygnus-arcgis] force null geometry when invalid geo:json format or type is found instead of Point(0,0) (#2379)
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public static Feature createInstanceFromJson(JsonObject json) throws ArcgisExcep
geometry = Point.createInstanceFromJson(jsonGeometry); // TODO another
//geometry types?
} else {
geometry = new Point(0, 0);
geometry = null;
}
Map<String, Object> attributes = attToMap(json.get(ATTRIBUTES_TAG).getAsJsonObject());
return new Feature(geometry, attributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,12 @@ protected void jsonElementToFeatureAttr(String attrName, String attrType, JsonEl

} else {
LOGGER.warn("Invalid geo:json type, only points allowed: " + location.toString());
feature.setGeometry(null);
}
} catch (Exception e) {
LOGGER.error("Invalid geo:json format, (sikipped): " + attrValue.toString() + " - Error: "
+ e.getMessage());
feature.setGeometry(null);
}
break;
case NGSI_BOOLEAN_DATATYPE:
Expand Down

0 comments on commit 22c6c24

Please sign in to comment.