-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from aodn/features/6008-reduce-polygon-decimal
Add reducer support
- Loading branch information
Showing
8 changed files
with
122 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
indexer/src/main/java/au/org/aodn/esindexer/utils/FileUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package au.org.aodn.esindexer.utils; | ||
|
||
import org.springframework.core.io.ClassPathResource; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
|
||
public class FileUtils { | ||
public static File saveResourceToTemp(String resourceName, String filename) { | ||
String tempDir = System.getProperty("java.io.tmpdir"); | ||
ClassPathResource resource = new ClassPathResource(resourceName); | ||
|
||
File tempFile = new File(tempDir, filename); | ||
try(InputStream input = resource.getInputStream()) { | ||
tempFile.deleteOnExit(); // Ensure the file is deleted when the JVM exits | ||
|
||
// Write the InputStream to the temporary file | ||
try (FileOutputStream outputStream = new FileOutputStream(tempFile)) { | ||
byte[] buffer = new byte[1024]; | ||
int bytesRead; | ||
while ((bytesRead = input.read(buffer)) != -1) { | ||
outputStream.write(buffer, 0, bytesRead); | ||
} | ||
} | ||
} catch (IOException e) { | ||
throw new RuntimeException(e); | ||
} | ||
return tempFile; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ server: | |
app: | ||
geometry: | ||
enableGridSpatialExtents: true | ||
reducerPrecision: 4.0 | ||
|
||
elasticsearch: | ||
index: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ spring: | |
app: | ||
geometry: | ||
enableGridSpatialExtents: true | ||
reducerPrecision: 4.0 | ||
|
||
management: | ||
endpoints: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
app: | ||
geometry: | ||
reducerPrecision: 4.0 | ||
|
||
management: | ||
endpoints: | ||
web: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
app: | ||
geometry: | ||
reducerPrecision: 4.0 | ||
|
||
management: | ||
endpoints: | ||
web: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters