This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/sis-site.git
commit c17a53b931cbdee09a3886ea18afd88c70a2ef68 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Thu Sep 28 11:41:25 2023 +0200 Update the version, Java requirement and the "How to" examples. --- content/_index.md | 4 ++-- content/coding-conventions.md | 18 +++++++----------- content/howto/datalake_to_datacube.md | 2 +- content/howto/read_geotiff.md | 3 +-- content/howto/read_netcdf.md | 3 +-- content/howto/write_raster.md | 34 ++++++++++++++++++++-------------- content/release-management.md | 4 ++-- layouts/shortcodes/version.html | 2 +- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/content/_index.md b/content/_index.md index c4a7ec3c..83f08d8e 100644 --- a/content/_index.md +++ b/content/_index.md @@ -59,9 +59,9 @@ The API and the data encodings follow [international standards](standards.html) ## Using Apache SIS {#user} -The latest SIS release is {{% version %}}, released December 2022, +The latest SIS release is {{% version %}}, released in October 2023, and can be [downloaded](downloads.html) as a `zip` files or as Maven dependencies. -This is the latest version that can be run on Java 8 (next version will require Java 11). +This version requires Java 11 or later. The EPSG geodetic dataset is optional for licensing reasons, but recommended. EPSG database installation is [described in a separated page](epsg.html). diff --git a/content/coding-conventions.md b/content/coding-conventions.md index f363fd16..8c762889 100644 --- a/content/coding-conventions.md +++ b/content/coding-conventions.md @@ -1,5 +1,5 @@ --- -title: Source code +title: Coding conventions --- This page describes some coding conventions applied in Apache {{% SIS %}} development. @@ -33,16 +33,12 @@ The `Envelope2D` class is another implementation of the same interface specializ ## Internal packages {#internal} -All classes in `org.apache.sis.internal` sub-packages are for SIS usage only and may change without warning in any future release. -Those classes are excluded from Javadoc and will not be exported by SIS Jigsaw modules. -Those packages may be renamed after SIS upgraded to JDK 9+. - -## Substitution for non-existent classes {#substitutions} - -When using a JDK 9+ class that does not exist on JDK 8, define a class of the same name in a -`org.apache.sis.internal` sub-package with the minimal amount of needed functionalities, -provided that it can be done with reasonable effort. -Otherwise just delete the JDK9-dependent code from the development branch. +The public API is made of all public classes in all exported packages, +i.e. packages declared in non-qualified `exports` statements in the `module-info.java` file. +All other classes are for SIS usage only and may change without warning in any future release. +Those classes are excluded from Javadoc and normally not accessible to users. +Contrarily to previous SIS versions, there is no longer any particular convention for internal package names. +They may or may not have `internal` in their name. # Code formatting {#formatting} diff --git a/content/howto/datalake_to_datacube.md b/content/howto/datalake_to_datacube.md index 7a0b489a..51e31e05 100644 --- a/content/howto/datalake_to_datacube.md +++ b/content/howto/datalake_to_datacube.md @@ -84,7 +84,7 @@ public class DataLakeToDataCube { System.out.printf("Extent of second set of slices:%n%s%n", r2.getGridGeometry().getExtent()); System.out.printf("Extent of third set of slices:%n%s%n", r3.getGridGeometry().getExtent()); - var aggregator = new CoverageAggregator(null); + var aggregator = new CoverageAggregator(); aggregator.add(r1); aggregator.add(r2); aggregator.add(r3); diff --git a/content/howto/read_geotiff.md b/content/howto/read_geotiff.md index 6bfe43aa..84fd24cb 100644 --- a/content/howto/read_geotiff.md +++ b/content/howto/read_geotiff.md @@ -40,7 +40,6 @@ import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.coverage.grid.GridCoverage; import org.apache.sis.coverage.grid.GridGeometry; -import org.apache.sis.coverage.grid.GridOrientation; import org.apache.sis.geometry.GeneralEnvelope; import org.apache.sis.referencing.CommonCRS; @@ -86,7 +85,7 @@ public class ReadGeoTIFF { var areaOfInterest = new GeneralEnvelope(CommonCRS.WGS84.universal(49, 2.5)); areaOfInterest.setRange(0, 46600, 467000); // Minimal and maximal easting values (metres) areaOfInterest.setRange(1, 5427000, 5428000); // Minimal and maximal northing values (metres). - data = firstImage.read(new GridGeometry(null, areaOfInterest, GridOrientation.HOMOTHETY), null); + data = firstImage.read(new GridGeometry(areaOfInterest), null); System.out.printf("Information about the resource subset:%n%s%n", data.getGridGeometry().getExtent()); } diff --git a/content/howto/read_netcdf.md b/content/howto/read_netcdf.md index d30150c0..9871d8f5 100644 --- a/content/howto/read_netcdf.md +++ b/content/howto/read_netcdf.md @@ -38,7 +38,6 @@ import org.apache.sis.storage.DataStoreException; import org.apache.sis.storage.GridCoverageResource; import org.apache.sis.coverage.grid.GridCoverage; import org.apache.sis.coverage.grid.GridGeometry; -import org.apache.sis.coverage.grid.GridOrientation; import org.apache.sis.geometry.GeneralEnvelope; import org.apache.sis.referencing.CommonCRS; @@ -84,7 +83,7 @@ public class ReadNetCDF { var areaOfInterest = new GeneralEnvelope(CommonCRS.WGS84.geographic()); areaOfInterest.setRange(0, 30, 40); // Minimal and maximal latitude values. areaOfInterest.setRange(1, -5, 4); // Minimal and maximal longitude values. - data = gridded.read(new GridGeometry(null, areaOfInterest, GridOrientation.HOMOTHETY), null); + data = gridded.read(new GridGeometry(areaOfInterest), null); System.out.printf("Information about the resource subset:%n%s%n", data.getGridGeometry().getExtent()); } else { diff --git a/content/howto/write_raster.md b/content/howto/write_raster.md index 0745d7d3..5b1f30c2 100644 --- a/content/howto/write_raster.md +++ b/content/howto/write_raster.md @@ -2,16 +2,13 @@ title: Write a raster to a file --- -This example saves a raster in PNG format. +This example saves a raster in PNG format together with its WorldFile PRJ and PGW auxiliary files. This example assumes a preloaded raster. For the loading part, see [read from a netCDF file](read_netcdf.html) or [read from a GeoTIFF file](read_geotiff.html) code examples. -Note: this example is incomplete. -A more complete example will be provided with next Apache SIS release. - # Direct dependencies @@ -26,8 +23,10 @@ The file name in following code need to be updated for yours data. {{< highlight java >}} import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; +import org.apache.sis.storage.DataStore; +import org.apache.sis.storage.DataStores; +import org.apache.sis.storage.DataStoreException; +import org.apache.sis.storage.WritableGridCoverageResource; import org.apache.sis.coverage.grid.GridCoverage; public class WriteRaster { @@ -35,17 +34,24 @@ public class WriteRaster { * Demo entry point. * * @param args ignored. - * @throws IOException if an error occurred while writing the raster. + * @throws DataStoreException if an error occurred while reading or writing the raster. */ - public static void main(String[] args) throws IOException { - GridCoverage data = ...; // See "Read netCDF" or "Read GeoTIFF" code examples. + public static void main(String[] args) throws DataStoreException { /* - * TODO: Apache SIS is missing a `DataStores.write(…)` convenience method. - * Writing a TIFF World File is possible but requires use of internal API. - * A public convenience method will be added in next version. - * For now we use Java I/O API. + * In this example we just read an existing grid coverage, + * but it could be the result of some calculation instead. + * See "Read netCDF" or "Read GeoTIFF" code examples. */ - ImageIO.write(data.render(null), "png", new File("test.png")); + GridCoverage data = ReadGeoTIFF.example(); + try (DataStore store = DataStores.openWritable(new File("output.png"), "PNG")) { + /* + * In this example, we use the knowledge that PNG format can store only one image. + * So we can cast to `WritableGridCoverageResource`. If the format supported many + * images (e.g. GeoTIFF), the store would rather be a `WritableAggregate`. + */ + var writable = (WritableGridCoverageResource) store; + writable.write(data); + } } } {{< / highlight >}} diff --git a/content/release-management.md b/content/release-management.md index a53b8f9c..9c5a9f1b 100644 --- a/content/release-management.md +++ b/content/release-management.md @@ -312,13 +312,13 @@ svn commit -m "Test project for SIS $NEW_VERSION-RC$RELEASE_CANDIDATE" {{< / highlight >}} Create a temporary directory where Apache {{% SIS %}} will write the EPSG dataset. -Force the Java version to the one supported by Apache SIS (adjust `JDK8_HOME` as needed). +Force the Java version to the one supported by Apache SIS (adjust `JDK11_HOME` as needed). Specify the URL to the nexus repository (will be needed in a future step. Replace `####` as needed). {{< highlight bash >}} mkdir target/SpatialMetadata export SIS_DATA=`pwd`/target/SpatialMetadata -export JAVA_HOME=$JDK8_HOME +export JAVA_HOME=$JDK11_HOME export JAVA_OPTS=-Dorg.apache.sis.epsg.downloadURL export JAVA_OPTS=$JAVA_OPTS=https://repository.apache.org/content/repositories/orgapachesis-#### export JAVA_OPTS=$JAVA_OPTS/org/apache/sis/non-free/sis-epsg/$NEW_VERSION/sis-epsg-$NEW_VERSION.jar diff --git a/layouts/shortcodes/version.html b/layouts/shortcodes/version.html index a58941b0..840ca8cb 100644 --- a/layouts/shortcodes/version.html +++ b/layouts/shortcodes/version.html @@ -1 +1 @@ -1.3 \ No newline at end of file +1.4 \ No newline at end of file