Skip to content
Snippets Groups Projects
Commit 01f2f1c3 authored by Zhibin Mai's avatar Zhibin Mai Committed by David Diederich
Browse files

Add SpatialArea as default geoshape property

(cherry picked from commit 800304b3)
parent 558d754f
Branches
Tags
6 merge requests!604Merge Delta changes from M16 master to M18 master,!600Merge Delta changes from M16 master to M18 master,!599Merge Delta changes from M16 to M18 master,!598Merged from M16,!522M14 cherrypick to m16 master,!405Cherry-pick 'Geoshape decimation' into release/0.17
Pipeline #140749 skipped
......@@ -43,6 +43,9 @@ import java.util.stream.Collectors;
@Component
public class StorageIndexerPayloadMapper {
private static final String SPATIAL_LOCATION_WGS84 = "SpatialLocation.Wgs84Coordinates";
private static final String SPATIAL_AREA_WGS84 = "SpatialArea.Wgs84Coordinates";
@Inject
private JaxRsDpsLog log;
@Inject
......@@ -238,10 +241,9 @@ public class StorageIndexerPayloadMapper {
}
// No VirtualProperties.DefaultLocation.Wgs84Coordinates defined, use the default geo-shape property
String defaultGeoShapeProperty = "SpatialLocation.Wgs84Coordinates";
if (originalGeoShapeProperty == null && dataCollectorMap.containsKey(defaultGeoShapeProperty))
originalGeoShapeProperty = defaultGeoShapeProperty;
if(decimationSetting.isDecimationEnabled()) {
if (originalGeoShapeProperty == null)
originalGeoShapeProperty = getDefaultGeoShapeProperty(dataCollectorMap);
if(originalGeoShapeProperty != null && decimationSetting.isDecimationEnabled()) {
try {
decimateGeoShape(originalGeoShapeProperty, dataCollectorMap);
} catch (JsonProcessingException ex) {
......@@ -250,6 +252,14 @@ public class StorageIndexerPayloadMapper {
}
}
private String getDefaultGeoShapeProperty(Map<String, Object> dataCollectorMap) {
if(dataCollectorMap.containsKey(SPATIAL_LOCATION_WGS84))
return SPATIAL_LOCATION_WGS84;
if(dataCollectorMap.containsKey(SPATIAL_AREA_WGS84))
return SPATIAL_AREA_WGS84;
return null;
}
private void decimateGeoShape(String originalGeoShapeProperty, Map<String, Object> dataCollectorMap) throws JsonProcessingException {
if(originalGeoShapeProperty == null || !dataCollectorMap.containsKey(originalGeoShapeProperty))
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment