Skip to content

Commit

Permalink
Merge pull request #166 from aodn/features/6008-remove-centroid
Browse files Browse the repository at this point in the history
Features/6008 remove centroid
  • Loading branch information
HavierD authored Nov 14, 2024
2 parents 5844fa4 + 8a68d2b commit 6197be9
Show file tree
Hide file tree
Showing 37 changed files with 8,404 additions and 15,543 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public RestClientTransport createRestClientTransport(@Value("${elasticsearch.ser
// Create the low-level client
RestClient restClient = RestClient
.builder(HttpHost.create(serverUrl))
.setCompressionEnabled(true)
.setDefaultHeaders(new Header[]{
new BasicHeader("Authorization", "ApiKey " + apiKey)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import java.util.concurrent.*;
import org.springframework.beans.factory.annotation.Value;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
Expand All @@ -24,20 +23,18 @@ public class IndexerConfig {
@Value("${app.geometry.enableGridSpatialExtents:false}")
protected boolean girdSpatialExtents;

@Value("${app.geometry.coastalPrecision:0.04}")
@Value("${app.geometry.coastalPrecision:0.5}")
protected double coastalPrecision;

@PostConstruct
public void init() {
GeometryUtils.setGridSpatialExtents(girdSpatialExtents);
GeometryUtils.setCoastalPrecision(coastalPrecision);
GeometryUtils.init();
}

@PreDestroy
public void cleanUp() {
// Clean up resources
GeometryUtils.getExecutorService().shutdown();
}
/**
* We need to create component here because we do not want to run test with real http connection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ void beforeMapping(MDMetadataType source) {
@Mapping(target="license", source = "source", qualifiedByName = "mapLicense")
@Mapping(target="providers", source = "source", qualifiedByName = "mapProviders")
@Mapping(target="citation", source="source", qualifiedByName = "mapCitation")
@Mapping(target="summaries.centroid", source = "source", qualifiedByName = "mapSummaries.centroid")
@Mapping(target="summaries.status", source = "source", qualifiedByName = "mapSummaries.status")
@Mapping(target="summaries.scope", source = "source", qualifiedByName = "mapSummaries.scope")
@Mapping(target="summaries.credits", source = "source", qualifiedByName = "mapSummaries.credits")
@Mapping(target="summaries.geometry", source = "source", qualifiedByName = "mapSummaries.geometry")
@Mapping(target="summaries.geometryNoLand", source = "source", qualifiedByName = "mapSummaries.geometryNoland")
@Mapping(target="summaries.temporal", source = "source", qualifiedByName = "mapSummaries.temporal")
@Mapping(target="summaries.updateFrequency", source = "source", qualifiedByName = "mapSummaries.updateFrequency")
@Mapping(target="summaries.datasetProvider", source = "source", qualifiedByName = "mapSummaries.datasetProvider")
Expand Down Expand Up @@ -91,8 +91,8 @@ String mapUUID(MDMetadataType source) {
List<List<BigDecimal>> mapExtentBbox(MDMetadataType source) {
return GeometryUtils.createGeometryItems(
source,
null,
BBoxUtils::createBBoxFrom
BBoxUtils::createBBoxFrom,
null
);
}

Expand Down Expand Up @@ -345,25 +345,25 @@ private HashMap<GeoNetworkField, String> getMetadataDateInfoFrom(List<AbstractTy
return dateMap;
}
/**
* This is the default centroid if requester do not indicate a zoom level
* @param source
* @return
* The spatial extends
* @param source - The parsed XML
* @return - The spatial extents without land
*/
@Named("mapSummaries.centroid")
List<List<BigDecimal>> mapGeometryCentroid(MDMetadataType source) {
@Named("mapSummaries.geometryNoland")
Map<?,?> mapSummariesGeometryNoLand(MDMetadataType source) {
return GeometryUtils.createGeometryItems(
source,
10,
GeometryUtils::createCentroidFrom
GeometryUtils::createGeometryNoLandFrom,
10
);
}

@Named("mapSummaries.geometry")
Map<?,?> mapSummariesGeometry(MDMetadataType source) {
return GeometryUtils.createGeometryItems(
source,
10, // This is useful in testing/edge only.
GeometryUtils::createGeometryFrom
GeometryUtils::createGeometryFrom,
10 // This is useful in testing/edge only.
);
}

Expand Down
Loading

0 comments on commit 6197be9

Please sign in to comment.