You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/09/25 21:10:00 UTC
[incubator-baremaps] 04/07: Experiment with TwelveMonkeys
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 4537a94cc86834d7b74d2e4689121b873b73cb4e
Author: Bertil Chapuis <bc...@gmail.com>
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 047dac81..7c364c2d 100644
--- a/baremaps-core/pom.xml
+++ b/baremaps-core/pom.xml
@@ -20,7 +20,29 @@
<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));
+ }
+ }
+ }
+}