This is an automated email from the ASF dual-hosted git repository. bchapuis pushed a commit to branch gdal in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit fec514b975eac7756ca950de08650d2bf2cc8a65 Author: Bertil Chapuis <[email protected]> AuthorDate: Mon Apr 24 13:20:23 2023 +0200 Experiment with TwelveMonkeys --- baremaps-core/pom.xml | 22 ++++++++++++++++++++++ .../java/org/apache/baremaps/raster/Image.java | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/baremaps-core/pom.xml b/baremaps-core/pom.xml index 55159841..e38f2be1 100644 --- a/baremaps-core/pom.xml +++ b/baremaps-core/pom.xml @@ -25,7 +25,29 @@ limitations under the License. <artifactId>baremaps-core</artifactId> + <repositories> + <repository> + <id>twelvemonkeys</id> + <url>https://oss.sonatype.org/content/repositories/snapshots/</url> + </repository> + </repositories> + <dependencies> + <dependency> + <groupId>com.twelvemonkeys.imageio</groupId> + <artifactId>imageio-tiff</artifactId> + <version>3.10.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>com.twelvemonkeys.imageio</groupId> + <artifactId>imageio-metadata</artifactId> + <version>3.9.4</version> + </dependency> + <dependency> + <groupId>org.apache.sis.storage</groupId> + <artifactId>sis-geotiff</artifactId> + <version>1.3</version> + </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> diff --git a/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java b/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java new file mode 100644 index 00000000..896304be --- /dev/null +++ b/baremaps-core/src/main/java/org/apache/baremaps/raster/Image.java @@ -0,0 +1,22 @@ +package org.apache.baremaps.raster; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.net.URL; + + +public class Image { + + public static void main(String[] args) throws IOException { + String urlString = String.format("https://s3.amazonaws.com/elevation-tiles-prod/geotiff/%s/%s/%s.tif", 14, 8492, 5792); + URL url = new URL(urlString); + BufferedImage tiffImage = ImageIO.read(url); + var raster = tiffImage.getRaster(); + for (int x = 0; x < raster.getWidth(); x++) { + for (int y = 0; y < raster.getHeight(); y++) { + System.out.println(raster.getSampleFloat(y, y, 0)); + } + } + } +}
