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 ed691be95d69f1ab124d5c157ab1e57350c09ad3 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Wed Jan 24 16:32:15 2024 +0100 Replace {{< highlight >}} statements by backticks in markdown files. --- content/code-patterns.md | 4 +- content/coding-conventions.md | 12 +- content/command-line.md | 76 ++++---- content/downloads.md | 32 ++-- content/epsg.md | 44 ++--- content/faq.md | 24 +-- content/formats.md | 12 +- content/howto/crs_equality.md | 4 +- content/howto/datalake_to_datacube.md | 4 +- content/howto/envelopes_in_different_crs.md | 4 +- content/howto/export_metadata_to_xml.md | 8 +- content/howto/geodetic_paths.md | 4 +- content/howto/geographic_bounding_box.md | 4 +- content/howto/instantiate_utm_projection.md | 4 +- content/howto/lookup_crs_urn.md | 4 +- content/howto/parallel_computation.md | 4 +- content/howto/parse_and_format_mgrs_codes.md | 4 +- .../raster_values_at_geographic_coordinates.md | 4 +- .../howto/raster_values_at_pixel_coordinates.md | 4 +- content/howto/rasters_bigger_than_memory.md | 4 +- content/howto/read_geotiff.md | 4 +- content/howto/read_netcdf.md | 4 +- content/howto/resample_raster.md | 4 +- content/howto/transform_coordinates.md | 4 +- content/howto/transform_envelopes.md | 4 +- content/howto/write_raster.md | 4 +- content/javafx.md | 4 +- content/release-management.md | 192 ++++++++++----------- content/source.md | 44 ++--- 29 files changed, 262 insertions(+), 262 deletions(-) diff --git a/content/code-patterns.md b/content/code-patterns.md index 9b9ff67c..6eb0abe5 100644 --- a/content/code-patterns.md +++ b/content/code-patterns.md @@ -76,13 +76,13 @@ Some "characters" are actually represented using two consecutive `char` elements Those "characters" are called <cite>code points</cite>. Consequently, when iterating over characters in a string, the following pattern should be used: -{{< highlight java >}} +```java for (int i=0; i<string.length();) { final int c = string.codePointAt(i); // ... do some stuff ... i += Character.charCount(c); } -{{< / highlight >}} +``` # Logging {#logging} diff --git a/content/coding-conventions.md b/content/coding-conventions.md index bd728032..57d0a6f6 100644 --- a/content/coding-conventions.md +++ b/content/coding-conventions.md @@ -14,9 +14,9 @@ shall have the same license header, but with lines prefixed by `#` instead of `* Properties files distributed as-is in the JAR files can summarize the license on a single line for saving space, as below: -{{< highlight text >}} +``` # Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. -{{< / highlight >}} +``` # Naming convention {#naming} @@ -65,14 +65,14 @@ Isolate at the end of the imports section any import statements that are specifi This separation allows any branch to re-arrange the common import statements without generating conflicts with the platform-dependent import statements. Example: -{{< highlight java >}} +```java import java.io.File; import java.util.List; import org.opengis.metadata.Metadata; // Specific to the geoapi-3.1 and geoapi-4.0 branches: import org.opengis.feature.Feature; -{{< / highlight >}} +``` The import statements can be rearranged automatically by the `ReorganizeImports` class in `buildSrc`. This tool requires checkouts of all three branches (`main`, `geoapi-3.1` and `geoapi-4.0`) in order @@ -113,12 +113,12 @@ Formatting the code in a way that emphase their symmetrical nature, for example aligning identical terms in columns, can help to understand the overall pattern and to identify bugs. Example: -{{< highlight java >}} +```java if (x < xmin) xmin = x; if (x > xmax) xmax = x; if (y < ymin) ymin = y; if (y > ymax) ymax = y; -{{< / highlight >}} +``` The decision to use standard or tabular format is made on a case-by-case basis. Of course, tabular format shall not be abused. diff --git a/content/command-line.md b/content/command-line.md index e0ea7efb..c0569a20 100644 --- a/content/command-line.md +++ b/content/command-line.md @@ -16,22 +16,22 @@ in their own application. Select "Apache {{% SIS %}} {{% version %}} binary" from the [downloads page](downloads.html) an unzip in any directory. The directory structure will be as below: -{{< highlight text >}} +``` apache-sis-{{% version %}} ├─ bin ├─ conf ├─ data ├─ lib └─ log -{{< / highlight >}} +``` The `bin` sub-directory contains a `sis` command for Unix systems (Linux or MacOS — we have not yet done a `sis.bat` file for Windows). The `bin` sub-directory can be added to the `PATH` environment variable for convenience, but this is not mandatory. Example: -{{< highlight bash >}} +```bash export PATH=$PWD/apache-sis-{{% version %}}/bin:$PATH -{{< / highlight >}} +``` The remaining of this page assumes that the `bin` directory is on the search path. If not, the same examples can still be executed by replacing the `sis` command by `./apache-sis-{{% version %}}/bin/sis`. @@ -56,9 +56,9 @@ See [issue SIS-545](https://issues.apache.org/jira/browse/SIS-545) for instructi Invoking `sis` without argument shows a summary of available commands and all options. For executing a command, the syntax is: -{{< highlight bash >}} +```bash sis <command> [options] [files] -{{< / highlight >}} +``` Available commands are: @@ -117,9 +117,9 @@ The [EPSG geodetic dataset](epsg.html) is a widely-used source of definitions fo Appache SIS provides a [list of supported codes](tables/CoordinateReferenceSystems.html), which can be queried from the command line. For example the following command prints the definition of the _"JGD2011 / Japan Plane Rectangular CS VIII"_ Coordinate Reference System: -{{< highlight bash >}} +```bash sis crs EPSG:6676 -{{< / highlight >}} +``` <details> <summary>Expected output (click to expand):</summary> @@ -197,15 +197,15 @@ but in which the `ID["EPSG", 27572]` element has been intentionally omitted. Furthermore, the _“NTF (Paris) / Lambert zone II”_ name has been replaced by _“NTF (Paris) / zone to be discovered by the demo”_ name. Executing the following command: -{{< highlight bash >}} +```bash sis identifier https://sis.apache.org/examples/crs/MissingIdentifier.wkt -{{< / highlight >}} +``` produces an output like below: -{{< highlight text >}} +``` urn:ogc:def:crs:EPSG:9.9.1:27572 | NTF (Paris) / Lambert zone II -{{< / highlight >}} +``` As we can see, Apache {{% SIS %}} has been able to find back the identifier code and the actual {{% CRS %}} name. @@ -215,53 +215,53 @@ but declare an EPSG code for a {{% CRS %}} with (_latitude_, _longitude_) axes. Apache {{% SIS %}} can detect such mismatches. For example executing the following command: -{{< highlight bash >}} +```bash sis identifier https://sis.apache.org/examples/crs/WrongAxisOrder.wkt -{{< / highlight >}} +``` produces an output like below: -{{< highlight text >}} +``` ! urn:ogc:def:crs:EPSG:8.9:4979 | WGS 84 Legend: ! Identified object matches definition provided by authority except for coordinate system axes. -{{< / highlight >}} +``` Apache {{% SIS %}} can perform such analysis because it “understands” the {{% CRS %}} definition. This analysis capability can be tested by altering the {{% CRS %}} definition. The next example asks the identifier of a {{% CRS %}} which is normally defined as below: -{{< highlight text >}} +``` ProjectedCRS["WGS 84 / Mercator 41", (... definition omitted for brevity ...) Method["Mercator (variant B)"], Parameter["Latitude of 1st standard parallel", -41.0], (... definition omitted for brevity ...) -{{< / highlight >}} +``` However in this example, we will provide a {{% CRS %}} defined as below: -{{< highlight text >}} +``` ProjectedCRS["Scaled Mercator", (... definition omitted for brevity ...) Method["Mercator (variant A)"], Parameter["Scale factor at natural origin", 0.7557992272019596"], Parameter["Latitude of natural origin", -0.0], (... definition omitted for brevity ...) -{{< / highlight >}} +``` Executing the following command: -{{< highlight bash >}} +```bash sis identifier https://sis.apache.org/examples/crs/EquivalentDefinition.wkt -{{< / highlight >}} +``` produces an output like below: -{{< highlight text >}} +``` urn:ogc:def:crs:EPSG:9.9.1:3994 | WGS 84 / Mercator 41 -{{< / highlight >}} +``` In above example, Apache {{% SIS %}} used the fact that a _“Mercator (variant A)”_ projection with a _“Scale factor at natural origin”_ parameter value of 0.755799… on the WGS84 datum is numerically equivalent to a @@ -286,65 +286,65 @@ The following example transform coordinates from the North American Datum 1927 ( The example is run twice: once for cities in USA, then once for cities in Canada: (Note: the application may log warnings to the console. Those warnings can be ignored) -{{< highlight bash >}} +```bash wget https://sis.apache.org/examples/coordinates/AmericanCities.csv wget https://sis.apache.org/examples/coordinates/CanadianCities.csv sis transform --sourceCRS EPSG:4267 --targetCRS EPSG:4326 AmericanCities.csv sis transform --sourceCRS EPSG:4267 --targetCRS EPSG:4326 CanadianCities.csv -{{< / highlight >}} +``` The first execution should print the following header, followed by transformed coordinate values. Note the operation code (EPSG:1173), domain of validity (United State) and accuracy. -{{< highlight text >}} +``` # Source: NAD27 (EPSG:4267) # Destination: WGS 84 (EPSG:4326) # Operations: NAD27 to WGS 84 (4) (EPSG:1173) # Domain: United States (USA) - onshore # Accuracy: 10.0 metres -{{< / highlight >}} +``` The second execution should print the following header, followed by transformed coordinate values. Note that the operation code (EPSG:1172), domain of validity (Canada) and accuracy are not the same than in previous example. -{{< highlight text >}} +``` # Source: NAD27 (EPSG:4267) # Destination: WGS 84 (EPSG:4326) # Operations: NAD27 to WGS 84 (3) (EPSG:1172) # Domain: Canada - onshore and offshore # Accuracy: 20.0 metres -{{< / highlight >}} +``` The difference between those two operations become more visible by adding the `--verbose` option to the above `sis transform` commands. This option shows the coordinate operation in Well Known Text (WKT) or pseudo-WKT format. When transforming coordinates in USA, the operation contains the following parameter values: -{{< highlight text >}} +``` Method["Geocentric translations (geog2D domain)"], Parameter["X-axis translation", -8.0, Unit["metre", 1]], Parameter["Y-axis translation", 160.0, Unit["metre", 1]], Parameter["Z-axis translation", 176.0, Unit["metre", 1]] -{{< / highlight >}} +``` But when transforming coordinates in Canada, the operation rather contains the following parameter values: -{{< highlight text >}} +``` Method["Geocentric translations (geog2D domain)"], Parameter["X-axis translation", -10.0, Unit["metre", 1]], Parameter["Y-axis translation", 158.0, Unit["metre", 1]], Parameter["Z-axis translation", 187.0, Unit["metre", 1]], -{{< / highlight >}} +``` As seen in the above examples, the parameter values differ slightly with the geographic area of the coordinates to transform. Those parameters could also be different if _datum shift grids_ are available. For example in USA: -{{< highlight text >}} +``` Method["NADCON"], Parameter["Latitude difference file", "conus.las"], Parameter["Longitude difference file", "conus.los"],\ -{{< / highlight >}} +``` Java API for accessing functionalities shown in above examples are: @@ -361,9 +361,9 @@ By default, the metadata are shown in a relatively compact tree-table format. But the metadata can optionally be exported as an {{% ISO %}} 19139 compliant XML document. The following example shows the metadata of a netCDF file accessible from the web: -{{< highlight bash >}} +```bash sis metadata https://github.com/opengeospatial/geoapi/raw/master/geoapi-conformance/src/main/resources/org/opengis/test/dataset/Cube4D_projected_float.nc -{{< / highlight >}} +``` <details> <summary>Fragment of expected output (click to expand):</summary> <pre>Metadata diff --git a/content/downloads.md b/content/downloads.md index 17f87eea..709799c1 100644 --- a/content/downloads.md +++ b/content/downloads.md @@ -33,24 +33,24 @@ Then verify the signatures using the following (replace `src` by `bin` or `doc` Using GNU Privacy Guard: -{{< highlight bash >}} +```bash gpg --import KEYS gpg --verify apache-sis-{{% version %}}-src.zip.asc -{{< / highlight >}} +``` Using PGP version 6: -{{< highlight bash >}} +```bash pgp -ka KEYS pgp apache-sis-{{% version %}}-src.zip.asc -{{< / highlight >}} +``` Using PGP version 5: -{{< highlight bash >}} +```bash pgpk -a KEYS pgpv apache-sis-{{% version %}}-src.zip.asc -{{< / highlight >}} +``` ## Build from the sources {#build} @@ -60,11 +60,11 @@ It requires Java 18 or higher for building, but the compilation result can be ex For installing the JAR files in the local Maven repository, execute the following command from the SIS project root: -{{< highlight bash >}} +```bash cd apache-sis-{{% version %}} gradle assemble gradle publishToMavenLocal # If use with Maven projects is desired. -{{< / highlight >}} +``` JAR files will be in the `endorsed/build/libs/` sub-directory. An Open/LibreOffice add-in will be in `endorsed/build/bundle/`. @@ -77,9 +77,9 @@ For including the JavaFX module in the build, define the `PATH_TO_FX` environmen with the path to the directory containing all JavaFX JAR files. Example on a Linux system (the path may vary): -{{< highlight bash >}} +```bash export PATH_TO_FX=/usr/lib/jvm/openjfx -{{< / highlight >}} +``` The application will bundled in a ZIP file in the `optional/build/bundle` directory. To test, uncompress in any directory and execute `apache-sis-{{% version %}}/bin/sisfx`. @@ -91,9 +91,9 @@ Apache SIS 1.4 and later use the Java Platform Module System (JPMS). Consequently applications should declare SIS JAR files on their module-path rather than their class-path. The easiest way is to declare the whole directory like below: -{{< highlight bash >}} +```bash java --module-path apache-sis-{{% version %}}/lib -{{< / highlight >}} +``` If the application using Apache SIS is not itself modularized, it may be necessary to add the `--add-modules ALL-MODULE-PATH` option. @@ -109,7 +109,7 @@ An easy approach to integrate Apache {{% SIS %}} into a Java project uses the [A dependency management tool to automatically obtain the required Java Archives (JAR) files from the network. Below are examples of declarations in a `pom.xml` file for building a project with a SIS core module. -{{< highlight xml >}} +```xml <properties> <sis.version>{{% version %}}</sis.version> </properties> @@ -129,7 +129,7 @@ Below are examples of declarations in a `pom.xml` file for building a project wi <scope>runtime</scope> </dependency> </dependencies> -{{< / highlight >}} +``` The `sis-referencing` module in above example can be replaced by one or many of the following modules: @@ -160,7 +160,7 @@ together with information about how to perform coordinate operations, their accu However usage of EPSG dataset requires acceptation of [EPSG terms of use][EPSG-ToU]. If you accept those terms of use, then the following dependency can be added: -{{< highlight xml >}} +```xml <dependencies> <dependency> <groupId>org.apache.sis.non-free</groupId> @@ -169,7 +169,7 @@ If you accept those terms of use, then the following dependency can be added: <scope>runtime</scope> </dependency> </dependencies> -{{< / highlight >}} +``` Above dependency uses a read-only embedded Derby database. Note that the need to uncompress the `sis-embedded-data.jar` file diff --git a/content/epsg.md b/content/epsg.md index b47ca40c..ea1dd746 100644 --- a/content/epsg.md +++ b/content/epsg.md @@ -37,9 +37,9 @@ This process can be used with the [Apache SIS {{% version %}} binary bundle](dow If the [command-line tool](command-line.html) has been downloaded and installed, just query any CRS. For example: -{{< highlight bash >}} +```bash sis crs EPSG:6676 -{{< / highlight >}} +``` Alternatively if the [JavaFX application](javafx.html) is used, just start the application. It may be necessary to open a random data file for triggering the EPSG dataset initialization. @@ -59,18 +59,18 @@ For using the installed EPSG geodetic dataset in your own application, apply *on Examples are shown below for Unix systems, assuming that the current directory is the directory where `apache-sis-{{% version %}}-bin.zip` has been unzipped (replace `myApp` and `MyMainClass` by the application to launch): -{{< highlight bash >}} +```bash export SIS_DATA=apache-sis-{{% version %}}/data java --class-path apache-sis-{{% version %}}/lib/sis-referencing.jar:myApp.jar MyMainClass -{{< / highlight >}} +``` If the `SIS_DATA` environment variable cannot be set, Java property can be used as a fallback: -{{< highlight bash >}} +```bash java -Dderby.system.home=apache-sis-{{% version %}}/data/Databases \ --class-path apache-sis-{{% version %}}/lib/sis-referencing.jar:myApp.jar \ MyMainClass -{{< / highlight >}} +``` Alternatively `SIS_DATA` or `derby.system.home` can be set to the path of any other directory which contain the same files. @@ -98,7 +98,7 @@ The target database must be specified by users with *one* of the following choic The Maven dependency is as below (the Derby dependency can be replaced by another database driver if that database is specified by JNDI): -{{< highlight xml >}} +```xml <dependencies> <dependency> <groupId>org.apache.sis.non-free</groupId> @@ -113,7 +113,7 @@ if that database is specified by JNDI): <scope>runtime</scope> </dependency> </dependencies> -{{< / highlight >}} +``` See the [download](downloads.html#epsg) page for more information about Maven dependency declaration. @@ -132,7 +132,7 @@ This dependency can be declared as below (see the [download](downloads.html#epsg) page for more information about Maven dependency declaration). Note that `sis-epsg` and `sis-embedded-data` should not be specified in the same project; only one is needed: -{{< highlight xml >}} +```xml <dependencies> <dependency> <groupId>org.apache.sis.non-free</groupId> @@ -141,7 +141,7 @@ Note that `sis-epsg` and `sis-embedded-data` should not be specified in the same <scope>runtime</scope> </dependency> </dependencies> -{{< / highlight >}} +``` The performance issue can be avoided if the JAR file is uncompressed. But uncompressed `sis-embedded-data.jar` file is more than 5 times larger than the compressed file. @@ -168,7 +168,7 @@ EPSG datasets version 10 and later are not yet supported.** The data source can be specified by Java code as below (replace the `main` method by any method where initialization occurs): -{{< highlight java >}} +```java import javax.sql.DataSource; import org.apache.sis.setup.Configuration; @@ -182,14 +182,14 @@ public void MyApp { return ds; } } -{{< / highlight >}} +``` ## Registration by Java Naming and Directory Interface {#jndi-java} Registration in JNDI can be done programmatically (by Java code) or by configuring XML files in some environments. Registration can be done by the following Java code, provided that a JNDI implementation is available on the classpath: -{{< highlight java >}} +```java // Example using PostgreSQL data source (org.postgresql.ds.PGSimpleDataSource) PGSimpleDataSource ds = new PGSimpleDataSource(); ds.setDatabaseName("SpatialMetadata"); @@ -198,14 +198,14 @@ ds.setDatabaseName("SpatialMetadata"); // Registration assuming that a JNDI implementation is available Context env = (Context) InitialContext.doLookup("java:comp/env"); env.bind("jdbc/SpatialMetadata", ds); -{{< / highlight >}} +``` If there is no JNDI environment, the `org.apache.sis.setup.Configuration` class can be used as a fallback: -{{< highlight bash >}} +```bash // Fallback if no JNDI environment is available. Configuration.current().setDatabase(() -> ds); -{{< / highlight >}} +``` ## Registration in web application containers {#jndi-webapp} @@ -218,25 +218,25 @@ When Apache {{% SIS %}} is used in a JavaEE container, the data source can be co 2. If using Derby, copy `derby.war` into the `$CATALINA_HOME/webapps` directory and specify the directory where the Derby databases are located (skip this step if another database is used): -{{< highlight bash >}} +```bash export JDK_JAVA_OPTIONS=-Dderby.system.home=$SIS_DATA/Databases -{{< / highlight >}} +``` 3. Declare the JNDI name in application `WEB-INF/web.xml` file: -{{< highlight xml >}} +```xml <resource-ref> <description>EPSG dataset and other metadata used by Apache SIS.</description> <res-ref-name>jdbc/SpatialMetadata</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> -{{< / highlight >}} +``` 4. Configure the data source in `$CATALINA_HOME/conf/context.xml` or in application `META-INF/context.xml` file (change attribute values as needed for the chosen JDBC driver): -{{< highlight xml >}} +```xml <Context crossContext="true"> <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource name = "jdbc/SpatialMetadata" @@ -247,7 +247,7 @@ export JDK_JAVA_OPTIONS=-Dderby.system.home=$SIS_DATA/Databases driverClassName = "org.apache.derby.jdbc.EmbeddedDriver" url = "jdbc:derby:SpatialMetadata"/> </Context> -{{< / highlight >}} +``` 5. If using Derby, verify on the `localhost:8080/derby/derbynet` page (skip this step if another database is used). diff --git a/content/faq.md b/content/faq.md index 0edd04a1..86b3b676 100644 --- a/content/faq.md +++ b/content/faq.md @@ -93,10 +93,10 @@ But Apache {{% SIS %}} rather defaults to axis order _as defined by the authorit but allows changing axis order to the (_x_, _y_) order after {{% CRS %}} creation. This change can be done with the following code: -{{< highlight java >}} +```java CoordinateReferenceSystem crs = ...; // CRS obtained by any means. crs = AbstractCRS.castOrCopy(crs).forConvention(AxesConvention.RIGHT_HANDED) -{{< / highlight >}} +``` ### Is IdentifiedObjects.lookupEPSG(…) a reliable inverse of CRS.forCode(…)? {#lookupReliability} @@ -126,15 +126,15 @@ and the EPSG geodetic dataset defines geographic Coordinate Reference Systems th If a coordinate transformation seems to produce totally wrong values, the first thing to do should be to print the source and target Coordinate Reference Systems: -{{< highlight java >}} +```java System.out.println(sourceCRS); System.out.println(targetCRS); -{{< / highlight >}} +``` Attention should be paid to the order of `AXIS` elements. In the example below, the Coordinate Reference System clearly uses (_latitude_, _longitude_) axis order: -{{< highlight text >}} +``` GeodeticCRS["WGS 84", Datum["World Geodetic System 1984", Ellipsoid["WGS 84", 6378137.0, 298.257223563]], @@ -142,7 +142,7 @@ GeodeticCRS["WGS 84", Axis["Geodetic latitude (Lat)", north], Axis["Geodetic longitude (Lon)", east], Unit["degree", 0.017453292519943295]] -{{< / highlight >}} +``` If (_longitude_, _latitude_) axis order is really wanted, Apache {{% SIS %}} can be forced to that order [as described above](#axisOrder). @@ -166,14 +166,14 @@ However ESRI and GDAL among others unconditionally use decimal degrees, ignoring (note: this remark does not apply to {{% WKT %}} 2). This problem can be identified by {{% WKT %}} inspection as in the following extract: -{{< highlight text >}} +``` PROJCS["Lambert II étendu", GEOGCS["Nouvelle Triangulation Française", ..., PRIMEM["Paris", 2.337229167], UNIT["grad", 0.01570796326794897]] PROJECTION["Lambert_Conformal_Conic_1SP"], PARAMETER["latitude_of_origin", 46.8], ...] -{{< / highlight >}} +``` The Paris prime meridian is located at approximately 2.597 gradians from Greenwich, which is 2.337 degrees. From this fact, we can see that the above {{% WKT %}} uses decimal degrees despite its `UNIT["grad"]` declaration. @@ -240,13 +240,13 @@ Java Virtual Machine implements the GeoAPI interfaces on-the-fly, using the `jav See the `Proxy` Javadoc for details, keeping in mind that the {{% ISO %}}/{{% OGC %}} name of a `java.lang.Class` or `java.lang.reflect.Method` object can be obtained as below: -{{< highlight java >}} +```java UML uml = method.getAnnotation(UML.class); if (uml != null) { String name = uml.identifier(); // Fetch the metadata here. } -{{< / highlight >}} +``` This is indeed the approach taken by the `org.apache.sis.metadata.sql` package for providing an implementation of all GeoAPI metadata interfaces reading their values directly from a SQL database. @@ -256,9 +256,9 @@ of all GeoAPI metadata interfaces reading their values directly from a SQL datab The classes given to the JAXB marshaller shall contain JAXB annotations, otherwise the following exception is thrown: -{{< highlight text >}} +``` javax.xml.bind.JAXBException: class MyCustomClass nor any of its super class is known to this context. -{{< / highlight >}} +``` The easiest workaround is to wrap the custom implementation into one of the implementations provided in the `org.apache.metadata.iso` package. diff --git a/content/formats.md b/content/formats.md index b88daca2..72eddaf0 100644 --- a/content/formats.md +++ b/content/formats.md @@ -95,7 +95,7 @@ The easiest way to open a file in read-only mode is as below. The `input` argument can be a `File`, `Path`, `URI`, `URL`, `InputStream`, `ReadableByteChannel` or a {{% JDBC %}} `DataSource` (non-exhaustive list). -{{< highlight java >}} +```java try (DataStore store = DataStores.open(input)) { // Assuming that we know that the data is a single raster: GridCoverageResource r = (GridCoverageResource) store; @@ -106,7 +106,7 @@ try (DataStore store = DataStores.open(input)) { // Assuming that we know that the data is two-dimensional: RenderedImage image = coverage.render(null); } -{{< / highlight >}} +``` Most of Apache {{% SIS %}} API is designed for multi-dimensional data. When requesting a `RenderedImage`, a two-dimensional slice must be specified, @@ -126,7 +126,7 @@ HTTP is supported by the base SIS storage modules with no need for additional de Data files can also be located on Amazon S3 storage service. For accessing those data, add the following dependency to the Maven project: -{{< highlight xml >}} +```xml <dependencies> <dependency> <groupId>org.apache.sis.cloud</groupId> @@ -135,18 +135,18 @@ For accessing those data, add the following dependency to the Maven project: <scope>runtime</scope> </dependency> </dependencies> -{{< / highlight >}} +``` With above dependency on the classpath, it is possible to instantiate `java.nio.Path` object with a value of the form `"S3://bucket/pseudo-directory/file"`. Login and password can be specified in a `~/.aws/credentials` file like below (Apache SIS does not yet manage credentials by itself). -{{< highlight config >}} +```config [default] aws_access_key_id = <some value> aws_secret_access_key = <some value> -{{< / highlight >}} +``` An alternative to above configuration is to set the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables. diff --git a/content/howto/crs_equality.md b/content/howto/crs_equality.md index a8daec9e..61ab3ce7 100644 --- a/content/howto/crs_equality.md +++ b/content/howto/crs_equality.md @@ -23,7 +23,7 @@ Maven coordinates | Module info # Code example -{{< highlight java >}} +```java import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.util.FactoryException; import org.apache.sis.referencing.CRS; @@ -61,7 +61,7 @@ public class CrsEquality { + CRS.findOperation(crs2, crs2, null).getMathTransform().isIdentity()); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/datalake_to_datacube.md b/content/howto/datalake_to_datacube.md index 51e31e05..244b46f4 100644 --- a/content/howto/datalake_to_datacube.md +++ b/content/howto/datalake_to_datacube.md @@ -51,7 +51,7 @@ The `cdm-core` dependency can be omitted for netCDF-3 (a.k.a. "classic"), The file name and geospatial coordinates in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStores; @@ -98,7 +98,7 @@ public class DataLakeToDataCube { } } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/envelopes_in_different_crs.md b/content/howto/envelopes_in_different_crs.md index 75b15604..2bd41dcb 100644 --- a/content/howto/envelopes_in_different_crs.md +++ b/content/howto/envelopes_in_different_crs.md @@ -21,7 +21,7 @@ Maven coordinates | Module info Note that all geographic coordinates below express latitude *before* longitude. -{{< highlight java >}} +```java import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.TransformException; @@ -52,7 +52,7 @@ public class UnionOfEnvelopes { System.out.println("Union result: " + union); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/export_metadata_to_xml.md b/content/howto/export_metadata_to_xml.md index 1e444eb9..33b1d89e 100644 --- a/content/howto/export_metadata_to_xml.md +++ b/content/howto/export_metadata_to_xml.md @@ -24,7 +24,7 @@ see the [geographic bounding box](geographic_bounding_box.html) code example. The file name in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.util.Map; import java.io.File; import java.io.StringWriter; @@ -60,7 +60,7 @@ public class ExportMetadata { } } } -{{< / highlight >}} +``` # Output @@ -68,7 +68,7 @@ public class ExportMetadata { The output depends on the data and the locale. Below is an example: -{{< highlight xml >}} +```xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <mdb:MD_Metadata xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/1.0" xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" @@ -335,4 +335,4 @@ Below is an example: </mdb:MD_MetadataScope> </mdb:metadataScope> </mdb:MD_Metadata> -{{< / highlight >}} +``` diff --git a/content/howto/geodetic_paths.md b/content/howto/geodetic_paths.md index 353b9063..e3841fb1 100644 --- a/content/howto/geodetic_paths.md +++ b/content/howto/geodetic_paths.md @@ -19,7 +19,7 @@ Maven coordinates | Module info | Remark Note that all geographic coordinates below express latitude *before* longitude. -{{< highlight java >}} +```java import java.awt.Shape; import org.apache.sis.referencing.CommonCRS; import org.apache.sis.referencing.GeodeticCalculator; @@ -45,7 +45,7 @@ public class GeodeticPaths { System.out.printf("Java2D shape class for approximating this path: %s%n", path.getClass()); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/geographic_bounding_box.md b/content/howto/geographic_bounding_box.md index 403b1c36..bb93d61d 100644 --- a/content/howto/geographic_bounding_box.md +++ b/content/howto/geographic_bounding_box.md @@ -22,7 +22,7 @@ depending how the Coordinate Reference System (CRS) is encoded in the GeoTIFF fi The file name in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import org.apache.sis.storage.Aggregate; import org.apache.sis.storage.DataStore; @@ -51,7 +51,7 @@ public class GetBBOX { } } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/instantiate_utm_projection.md b/content/howto/instantiate_utm_projection.md index 145c6a0a..11517653 100644 --- a/content/howto/instantiate_utm_projection.md +++ b/content/howto/instantiate_utm_projection.md @@ -43,7 +43,7 @@ or the "AUTO" authority, but is required for examples using the "EPSG" authority Note that all geographic coordinates below express latitude *before* longitude, except in "AUTO2" authority code. -{{< highlight java >}} +```java import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.util.FactoryException; import org.apache.sis.referencing.CRS; @@ -79,7 +79,7 @@ public class InstantiateUTM { System.out.println("EPSG: " + Utilities.equalsIgnoreMetadata(crsFromPoint, crsFromCode)); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/lookup_crs_urn.md b/content/howto/lookup_crs_urn.md index 8e9e6cd2..a8e95dcb 100644 --- a/content/howto/lookup_crs_urn.md +++ b/content/howto/lookup_crs_urn.md @@ -36,7 +36,7 @@ for finding its value. # Code example -{{< highlight java >}} +```java import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.util.FactoryException; import org.apache.sis.referencing.CRS; @@ -82,7 +82,7 @@ public class LookupAuthorityCode { + IdentifiedObjects.lookupURN(crs, null)); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/parallel_computation.md b/content/howto/parallel_computation.md index 1de672a1..12a79664 100644 --- a/content/howto/parallel_computation.md +++ b/content/howto/parallel_computation.md @@ -22,7 +22,7 @@ Maven coordinates | Module info | Remarks # Code example -{{< highlight java >}} +```java import java.awt.image.ImagingOpException; import java.awt.image.RenderedImage; import org.apache.sis.coverage.grid.GridCoverage; @@ -57,4 +57,4 @@ public class ParallelTileComputation { */ } } -{{< / highlight >}} +``` diff --git a/content/howto/parse_and_format_mgrs_codes.md b/content/howto/parse_and_format_mgrs_codes.md index 60dece71..b1c1e094 100644 --- a/content/howto/parse_and_format_mgrs_codes.md +++ b/content/howto/parse_and_format_mgrs_codes.md @@ -19,7 +19,7 @@ Maven coordinates | Module info | Remark Note that all geographic coordinates below express latitude *before* longitude. -{{< highlight java >}} +```java import org.apache.sis.geometry.DirectPosition2D; import org.apache.sis.referencing.CommonCRS; import org.apache.sis.referencing.gazetteer.MilitaryGridReferenceSystem; @@ -48,7 +48,7 @@ public class MGRS { System.out.printf("Back to geographic coordinates: %s%n", reverse); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/raster_values_at_geographic_coordinates.md b/content/howto/raster_values_at_geographic_coordinates.md index a51c4a6d..136fc868 100644 --- a/content/howto/raster_values_at_geographic_coordinates.md +++ b/content/howto/raster_values_at_geographic_coordinates.md @@ -32,7 +32,7 @@ Maven coordinates | Module info | Remarks The geographic coordinates in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.util.Map; import javax.measure.Unit; import org.apache.sis.coverage.grid.GridCoverage; @@ -86,7 +86,7 @@ public class RasterValuesAtGeographicCoordinates { System.out.printf("- Value at %s is %g %s.%n", point, values[band], unit); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/raster_values_at_pixel_coordinates.md b/content/howto/raster_values_at_pixel_coordinates.md index d73968ed..166f7ac9 100644 --- a/content/howto/raster_values_at_pixel_coordinates.md +++ b/content/howto/raster_values_at_pixel_coordinates.md @@ -31,7 +31,7 @@ Maven coordinates | Module info | Remarks The pixel coordinates in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.awt.Point; import java.awt.image.RenderedImage; import javax.measure.Unit; @@ -84,7 +84,7 @@ public class RasterValuesAtPixelCoordinates { System.out.printf("Value at (100,200) is %g %s.%n", value, unit); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/rasters_bigger_than_memory.md b/content/howto/rasters_bigger_than_memory.md index e4a2451f..09da2d93 100644 --- a/content/howto/rasters_bigger_than_memory.md +++ b/content/howto/rasters_bigger_than_memory.md @@ -35,7 +35,7 @@ depending how the Coordinate Reference System (CRS) is encoded in the GeoTIFF fi The file name in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import java.util.Collection; import java.awt.Rectangle; @@ -109,7 +109,7 @@ public class RasterBiggerThanMemory { System.out.printf("A sample value in the arbitrary tile: %d%n", tile.getSample(93710, 57680, 2)); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/read_geotiff.md b/content/howto/read_geotiff.md index 84fd24cb..fc8ccbe1 100644 --- a/content/howto/read_geotiff.md +++ b/content/howto/read_geotiff.md @@ -28,7 +28,7 @@ depending how the Coordinate Reference System (CRS) is encoded in the GeoTIFF fi The file name and geospatial coordinates in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import java.util.Collection; import java.awt.image.ImagingOpException; @@ -97,7 +97,7 @@ public class ReadGeoTIFF { return data; } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/read_netcdf.md b/content/howto/read_netcdf.md index 9871d8f5..b2d08417 100644 --- a/content/howto/read_netcdf.md +++ b/content/howto/read_netcdf.md @@ -28,7 +28,7 @@ The `cdm-core` dependency can be omitted for netCDF-3 (a.k.a. "classic"), The file name, resource name and geographic coordinates in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import org.apache.sis.storage.Resource; import org.apache.sis.storage.Aggregate; @@ -117,7 +117,7 @@ public class ReadNetCDF { System.out.println(); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/resample_raster.md b/content/howto/resample_raster.md index 8e498b1f..dbe27cdd 100644 --- a/content/howto/resample_raster.md +++ b/content/howto/resample_raster.md @@ -27,7 +27,7 @@ for example using Well Known Text (WKT) format. The file name in following code need to be updated for yours data. -{{< highlight java >}} +```java import org.apache.sis.coverage.grid.GridCoverage; import org.apache.sis.coverage.grid.GridCoverageProcessor; import org.apache.sis.image.Interpolation; @@ -57,7 +57,7 @@ public class ResampleRaster { System.out.printf("Information about the image after reprojection:%n%s%n", data.getGridGeometry()); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/transform_coordinates.md b/content/howto/transform_coordinates.md index 455a235c..853fed73 100644 --- a/content/howto/transform_coordinates.md +++ b/content/howto/transform_coordinates.md @@ -28,7 +28,7 @@ In general, results are more accurate and/or more reliable in presence of EPSG d Note that all geographic coordinates below express latitude *before* longitude. -{{< highlight java >}} +```java import org.opengis.geometry.DirectPosition; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.CoordinateOperation; @@ -65,7 +65,7 @@ public class TransformCoordinates { System.out.println("Target: " + ptDst); } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/transform_envelopes.md b/content/howto/transform_envelopes.md index 084e4ac6..57eb084a 100644 --- a/content/howto/transform_envelopes.md +++ b/content/howto/transform_envelopes.md @@ -27,7 +27,7 @@ Maven coordinates | Module info Note that all geographic coordinates below express latitude *before* longitude. -{{< highlight java >}} +```java import org.opengis.geometry.Envelope; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.operation.CoordinateOperation; @@ -92,7 +92,7 @@ public class TransformEnvelopes { return result; } } -{{< / highlight >}} +``` # Output diff --git a/content/howto/write_raster.md b/content/howto/write_raster.md index 5b1f30c2..f9e32f14 100644 --- a/content/howto/write_raster.md +++ b/content/howto/write_raster.md @@ -21,7 +21,7 @@ Maven coordinates | Module info | Remarks The file name in following code need to be updated for yours data. -{{< highlight java >}} +```java import java.io.File; import org.apache.sis.storage.DataStore; import org.apache.sis.storage.DataStores; @@ -54,4 +54,4 @@ public class WriteRaster { } } } -{{< / highlight >}} +``` diff --git a/content/javafx.md b/content/javafx.md index c17e71fc..fa0fd618 100644 --- a/content/javafx.md +++ b/content/javafx.md @@ -18,9 +18,9 @@ Select "Apache {{% SIS %}} {{% version %}} binary" from the [downloads page](dow See the [command line](command-line.html) page for a description of the directory structure. For launching the application, execute (on Unix system): -{{< highlight bash >}} +```bash ./apache-sis-{{% version %}}/bin/sisfx -{{< / highlight >}} +``` On first execution, the application will ask user to download the [JavaFX framework][JavaFX] (if not already done). That framework is not included in the Apache {{% SIS %}} binaries for licensing reasons (it is under GPL license). diff --git a/content/release-management.md b/content/release-management.md index adc785b3..391e7119 100644 --- a/content/release-management.md +++ b/content/release-management.md @@ -35,7 +35,7 @@ where `$NEW_VERSION` and `$RELEASE_CANDIDATE` are environment variables introduc Some directories are Git checkout, other are ordinary directories. Any other layout can be used, provided that all relative paths in this page are adjusted accordingly. -{{< highlight text >}} +``` <any root directory for SIS> ├─ $NEW_VERSION-RC ├─ main @@ -53,11 +53,11 @@ provided that all relative paths in this page are adjusted accordingly. ├─ asf-staging ├─ javadoc └─ main -{{< / highlight >}} +``` Create the above directory structure as below: -{{< highlight bash >}} +```bash mkdir site mkdir release git clone https://gitbox.apache.org/repos/asf/sis.git main @@ -68,7 +68,7 @@ svn checkout https://dist.apache.org/repos/dist/dev/sis release/distribution cd site/main git worktree add ../asf-staging asf-staging git worktree add ../asf-site asf-site -{{< / highlight >}} +``` ## Generate GPG key {#generate-key} @@ -82,27 +82,27 @@ The following steps provide a summary: Edit the `~/.gnupg/gpg.conf` configuration file and add the following configuration options, or edit the existing values if any: -{{< highlight text >}} +``` personal-digest-preferences SHA512 cert-digest-algo SHA512 default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed -{{< / highlight >}} +``` If a private key already exists for emails or other purposes, it may be a good idea to keep that key as the default one. Add or modify the following line in the `gpg.conf` file, replacing `<previous_key_id>` by the existing key identifier (a value like `621CC013`): -{{< highlight text >}} +``` default-key <previous_key_id> -{{< / highlight >}} +``` Generate 4096 bits RSA key pair using the following command-line. GPG will prompts for various informations. The list below the command suggests some values, keeping in mind that the new key should be used only for signing Apache software packages, not for daily emails. -{{< highlight bash >}} +```bash gpg --gen-key -{{< / highlight >}} +``` * Kind of key: RSA and RSA (default). Do not create DSA key. * Key size: 4096 bits. @@ -115,18 +115,18 @@ gpg --gen-key Verify the key information (replace _Real Name_ by the above-cited developer's name, keeping quotes in the command below). Note the key identifier, which is a value like `74383E9D`. This key identifier will be needed for the next steps. -{{< highlight bash >}} +```bash gpg --list-sigs "Real Name" -{{< / highlight >}} +``` Sends the public key to a keys server (replace `<key_id>` by the above-cited key identifier). The default GPG configuration sends the key to `hkp://keys.gnupg.net`. Note that while there is many key servers, most of them synchronize changes with each other, so a key uploaded to one should be disseminated to the rest. -{{< highlight bash >}} +```bash gpg --send-key <key_id> -{{< / highlight >}} +``` The key publication can be verified by going on the [MIT server][MIT], then entering the developer's "Real Name" in the _Search String_ field. @@ -136,9 +136,9 @@ Generate a revocation certificate. This is not for immediate use, but generating is a safety in case the passphrase is lost. Keep the revocation certificate in a safe place, preferably on a removable device. -{{< highlight bash >}} +```bash gpg --output revocation_certificate.asc --gen-revoke <key_id> -{{< / highlight >}} +``` ## Web of trust {#trust} @@ -148,12 +148,12 @@ the machine of the other Apache commiter, where `<key_to_use>` is the identifier Those operation should preferably be done in some event where the commiters can meet face-to-face. The other commiter should verify that the `gpg --fingerprint` command output matches the fingerprint of the key to sign. -{{< highlight bash >}} +```bash gpg --recv-keys <key_id> gpg --fingerprint <key_id> gpg --default-key <key_to_use> --sign-key <key_id> gpg --send-key <key_id> -{{< / highlight >}} +``` The above-cited _Release Signing_ page provides more instructions. Then, the signed public key shall be appended to the `KEYS` file on the [SIS source code repository][source], @@ -164,10 +164,10 @@ then copied to the [SIS distribution directory][dist]. Edit the `~/.gradle/gradle.properties` file, making sure that the following properties are present: -{{< highlight text >}} +``` org.gradle.java.home=<path to a Java installation> signing.gnupg.keyName=<your key ID> -{{< / highlight >}} +``` ## Maven configuration {#maven-config} @@ -175,7 +175,7 @@ signing.gnupg.keyName=<your key ID> Edit the `~/.m2/setting.xml` file, making sure that the following fragments are present. Note that the [password can be enctypted](https://maven.apache.org/guides/mini/guide-encryption.html). -{{< highlight xml >}} +```xml <settings> <servers> <server> @@ -185,7 +185,7 @@ Note that the [password can be enctypted](https://maven.apache.org/guides/mini/g </server> </servers> </settings> -{{< / highlight >}} +``` # Specific release configuration {#release-config} @@ -194,13 +194,13 @@ For all instructions in this page, `$OLD_VERSION` and `$NEW_VERSION` stand for t number of the previous and the new release respectively, and `$RELEASE_CANDIDATE` stands for the current release attempt. Those versions shall be set on the command line like below (Unix): -{{< highlight bash >}} +```bash gpg --list-keys # For getting the value to put in <your key ID> export OLD_VERSION=1.3 export NEW_VERSION={{% version %}} export RELEASE_CANDIDATE=1 export SIGNING_KEY=<your key ID> # hexadecimal number with 8 or 40 digits. -{{< / highlight >}} +``` Make sure that the code signing key is the defauly key declared in `~/.gnupg/gpg.conf` during the Maven deployment phase. @@ -217,11 +217,11 @@ Replace the `$OLD_VERSION` number by `$NEW_VERSION` in the values of following p Commit and merge with other branches up to main branch. -{{< highlight bash >}} +```bash git add --update git commit --message="Set version number and the EPSG geodetic dataset URL to expected values after release." # merge with main -{{< / highlight >}} +``` Before to start the release process, we need to test more extensively the main branch. The tests described below often reveal errors that were unnoticed in daily builds. @@ -231,21 +231,21 @@ First, ensure that a PostgreSQL server is running and listening to the default p see [PostgreSQL testing configuration](./source.html#postgres) for more details). Then execute the following commands and fix as much warnings as practical: -{{< highlight bash >}} +```bash systemctl start postgresql.service # Optional — exact command depends on Linux distribution. gradle test --system-prop org.apache.sis.test.extensive=true -{{< / highlight >}} +``` If the `SIS_DATA` environment variable was set during above build, unset it a try again. Ideally the build should be tested in both conditions (`SIS_DATA` set and unset). That test may be done in a separated shell (console window) in order to preserve the variable value in the shell performing the release. -{{< highlight bash >}} +```bash unset SIS_DATA echo $SIS_DATA gradle cleanTest test -{{< / highlight >}} +``` ## Update the list of supported CRS {#update-crs-list} @@ -265,7 +265,7 @@ Those steps are also useful as additional tests, since failure to generate those * Run the following commands: - {{< highlight bash >}} + ```bash gradle assemble java --module-path endorsed/build/libs \ @@ -280,7 +280,7 @@ Those steps are also useful as additional tests, since failure to generate those --add-reads org.apache.sis.referencing=org.opengis.geoapi.conformance,junit \ --patch-module org.apache.sis.referencing=endorsed/build/classes/java/test/org.apache.sis.referencing \ --module org.apache.sis.referencing/org.apache.sis.referencing.report.CoordinateReferenceSystems - {{< / highlight >}} + ``` * If successful, HTML files will be generated in the current directory. Open those files in a web browser and verify that information are okay, @@ -288,9 +288,9 @@ Those steps are also useful as additional tests, since failure to generate those * If okay, move those two HTML files to the `../site/main/static/tables/` directory, overwriting previous files. Revert the hack in `AuthorityCodes` class, then commit: - {{< highlight bash >}} + ```bash git commit --message="Update the list CRS and operation methods supported by Apache SIS $NEW_VERSION." - {{< / highlight >}} + ``` ## Prepare release notes {#release-notes} @@ -310,13 +310,13 @@ Update [JIRA][JIRA] tasks and prepare release notes as below: Commit to staging area (not published immediately): -{{< highlight bash >}} +```bash cd ../site/main cp content/release-notes/$OLD_VERSION.md content/release-notes/$NEW_VERSION.md # Edit release notes before to continue. git add content/release-notes/$NEW_VERSION.md git commit --message "Release notes for Apache SIS $NEW_VERSION." -{{< / highlight >}} +``` # Create release artifacts {#create-artifacts} @@ -325,20 +325,20 @@ Execute the following commands. It is okay to checkout the branch in a separated directory if desired. The `SIS_RC_DIR` environment variable will specify that directory. -{{< highlight bash >}} +```bash cd ../main git checkout -b $NEW_VERSION-RC export SIS_RC_DIR=`pwd` -{{< / highlight >}} +``` Remove the files and modules that are not intended to be released. For example, Apache source distribution shall not include Gradle wrapper binary. -{{< highlight bash >}} +```bash git rm .asf.yaml git rm -r gradlew gradlew.bat gradle/ git rm -r incubator -{{< / highlight >}} +``` Edit at least the files listed below for removing all occurrences of "incubator" (the search is easier to do after the removal of "incubator" directory): @@ -351,11 +351,11 @@ Edit at least the files listed below for removing all occurrences of "incubator" Commit the removals: -{{< highlight bash >}} +```bash # Edit above-listed files before to continue. git add --update # for the removal of <module> elements in pom.xml files. git commit --message="Remove the modules to be excluded from $NEW_VERSION release." -{{< / highlight >}} +``` Update SIS version numbers by removing all occurrences of the `-SNAPSHOT` suffix at least in the following files: @@ -368,11 +368,11 @@ at least in the following files: Then commit: -{{< highlight bash >}} +```bash git add --update gradle test git commit --message="Set version number to $NEW_VERSION." -{{< / highlight >}} +``` ## Initialize the distribution directory {#dist} @@ -380,21 +380,21 @@ git commit --message="Set version number to $NEW_VERSION." Create the directory for the new version and release candidate within the distribution directory. The `$RELEASE_CANDIDATE` variable shall be the number of current release attempt. -{{< highlight bash >}} +```bash cd ../release/distribution svn update mkdir -p $NEW_VERSION/RC$RELEASE_CANDIDATE svn add $NEW_VERSION cd $NEW_VERSION/RC$RELEASE_CANDIDATE export DIST_DIR=`pwd` -{{< / highlight >}} +``` Copy the `HEADER.html` file from the previous release. Update the file content if necessary. -{{< highlight bash >}} +```bash svn copy https://dist.apache.org/repos/dist/release/sis/$OLD_VERSION/HEADER.html . -{{< / highlight >}} +``` ## Generate Javadoc {#javadoc} @@ -402,11 +402,11 @@ svn copy https://dist.apache.org/repos/dist/release/sis/$OLD_VERSION/HEADER.html Execute `gradle javadoc`. That command will fail. This is a known problem with the current Gradle build configuration. But it should have created a `javadoc.options` file that we will patch as below (`gedit` can be replaced by another editor): -{{< highlight bash >}} +```bash cd $SIS_RC_DIR gradle javadoc # Fail. See workaround below. gedit endorsed/build/tmp/javadoc/javadoc.options -{{< / highlight >}} +``` Apply the following changes: @@ -415,15 +415,15 @@ Apply the following changes: * Delete all Java source files listed after the options, everything until the end of file. * Add the following line in-place of deleted lines (omit the `org.opengis.geoapi` module if not desired): -{{< highlight text >}} +``` --module org.opengis.geoapi,org.apache.sis.util,org.apache.sis.metadata,org.apache.sis.referencing,org.apache.sis.referencing.gazetteer,org.apache.sis.feature,org.apache.sis.storage,org.apache.sis.storage.sql,org.apache.sis.storage.xml,org.apache.sis.storage.netcdf,org.apache.sis.storage.geotiff,org.apache.sis.storage.earthobservation,org.apache.sis.cloud.aws,org.apache.sis.portrayal,org.apache.sis.profile.france,org.apache.sis.profile.japan,org.apache.sis.openoffice,org.apache.sis.conso [...] -{{< / highlight >}} +``` The following commands temporarily create links to optional modules for inclusion in the Javadoc. The GeoAPI interfaces may also be copied if they should be bundled with the Javadoc. Then the Javadoc command is launched manually. -{{< highlight bash >}} +```bash cd endorsed/src ln -s ../../optional/src/org.apache.sis.gui cd - @@ -438,12 +438,12 @@ javadoc @endorsed/build/tmp/javadoc/javadoc.options firefox endorsed/build/docs/javadoc/index.html # For verifying the result. rm endorsed/src/org.apache.sis.gui rm -r endorsed/src/org.opengis.geoapi -{{< / highlight >}} +``` Prepares the Javadoc ZIP file to be released. Then update the online Javadoc: -{{< highlight bash >}} +```bash cd endorsed/build/docs/ mv javadoc apidocs zip -9 -r $DIST_DIR/apache-sis-$NEW_VERSION-doc.zip apidocs @@ -454,7 +454,7 @@ mv $SIS_RC_DIR/endorsed/build/docs/apidocs/* . git checkout -- README.md git add --all git commit --message "Update javadoc for SIS $NEW_VERSION." -{{< / highlight >}} +``` ## Publish Maven artifacts {#publish-artifacts} @@ -467,10 +467,10 @@ If there is any issue with the deployment, the staging repository can easily be Execute the following: -{{< highlight bash >}} +```bash cd $SIS_RC_DIR/parent mvn clean install deploy --activate-profiles apache-release -{{< / highlight >}} +``` Connect to the [Nexus repository][repository]. The artifacts can be found under _Build Promotion_ → _Staging repositories_, @@ -489,7 +489,7 @@ Build the project and publish in the Maven local repository. The `org.apache.sis.releaseVersion` property will cause Javadoc to be generated for earch artifact (this step is normally skipped because a bit long) and sign the artifacts. -{{< highlight bash >}} +```bash cd $SIS_RC_DIR git status # Make sure that everything is clean. gradle clean @@ -513,7 +513,7 @@ ll ~/.m2/repository/org/apache/sis/application/sis-javafx/$NEW_VERSION find ~/.m2/repository/org/apache/sis -name "sis-*-$NEW_VERSION-*.asc" -exec gpg --verify '{}' \; gradle publish --system-prop org.apache.sis.releaseVersion=$NEW_VERSION -{{< / highlight >}} +``` In the [Nexus repository][repository], click on "Refresh". A new `org.apache.sis` item should appear in the _Repository_ column of _Build Promotion_ → _Staging repositories_. @@ -531,14 +531,14 @@ Go to the directory that contains a checkout of `https://svn.apache.org/repos/as Those modules will not be part of the distribution (except on Maven), but we nevertheless need to ensure that they work. Replace occurrences of `<version>$OLD_VERSION</version>` by `<version>$NEW_VERSION</version>` in the `pom.xml` files. -{{< highlight bash >}} +```bash cd ../non-free svn update mvn clean install mvn javadoc:javadoc # Test that Javadoc can be generated. svn commit --message "Set version number and dependencies to $NEW_VERSION." mvn deploy --activate-profiles apache-release -{{< / highlight >}} +``` Verify the staged artifacts in the [Nexus repository][repository]. In the `sis-epsg-$NEW_VERSION.jar` file, verify that `META-INF/LICENSE` contains the EPSG terms of use. @@ -559,15 +559,15 @@ By contrast, above Maven artifacts are only conveniences. We have already staged the Javadoc and binaries. Now stage the sources and cleanup: -{{< highlight bash >}} +```bash git archive --prefix apache-sis-$NEW_VERSION-src/ --output $DIST_DIR/apache-sis-$NEW_VERSION-src.zip $NEW_VERSION-RC cd $DIST_DIR zip -d apache-sis-$NEW_VERSION-bin.zip apache-sis-$NEW_VERSION/lib/org.apache.sis.openoffice.jar -{{< / highlight >}} +``` Sign the source, Javadoc and binary artifacts: -{{< highlight bash >}} +```bash gpg --armor --detach-sign --default-key $SIGNING_KEY apache-sis-$NEW_VERSION-src.zip sha512sum apache-sis-$NEW_VERSION-src.zip > apache-sis-$NEW_VERSION-src.zip.sha512 @@ -576,14 +576,14 @@ sha512sum apache-sis-$NEW_VERSION-doc.zip > apache-sis-$NEW_VERSION-doc.zip.sha5 gpg --armor --detach-sign --default-key $SIGNING_KEY apache-sis-$NEW_VERSION-bin.zip sha512sum apache-sis-$NEW_VERSION-bin.zip > apache-sis-$NEW_VERSION-bin.zip.sha512 -{{< / highlight >}} +``` Verify checksums and signatures: -{{< highlight bash >}} +```bash find . -name "*.sha512" -exec sha512sum --check '{}' \; find . -name "*.asc" -exec gpg --verify '{}' \; -{{< / highlight >}} +``` # Integration test {#integration-tests} @@ -592,21 +592,21 @@ Create a temporary directory where Apache {{% SIS %}} will write the EPSG datase Force the Java version to the one supported by Apache SIS (adjust `JDK11_HOME` as needed). Specify the URL to the nexus repository, where `####` is the identifier of the "non-free" repository. -{{< highlight bash >}} +```bash export SIS_DATA=/tmp/apache-sis-data mkdir $SIS_DATA export JAVA_HOME=$JDK11_HOME export JDK_JAVA_OPTIONS="-enableassertions -Dorg.apache.sis.epsg.downloadURL" export JDK_JAVA_OPTIONS=$JDK_JAVA_OPTIONS=https://repository.apache.org/content/repositories/orgapachesis-#### export JDK_JAVA_OPTIONS=$JDK_JAVA_OPTIONS/org/apache/sis/non-free/sis-epsg/$NEW_VERSION/sis-epsg-$NEW_VERSION.jar -{{< / highlight >}} +``` ## Test the binary {#test-binary} Unzip the binaries and execute the examples documented in the [command-line interface page](./command-line.html). -{{< highlight bash >}} +```bash cd /tmp unzip $DIST_DIR/apache-sis-$NEW_VERSION-bin.zip cd apache-sis-$NEW_VERSION @@ -619,7 +619,7 @@ wget https://sis.apache.org/examples/coordinates/CanadianCities.csv ./bin/sis transform --sourceCRS EPSG:4267 --targetCRS EPSG:4326 AmericanCities.csv ./bin/sis transform --sourceCRS EPSG:4267 --targetCRS EPSG:4326 CanadianCities.csv ./bin/sisfx -{{< / highlight >}} +``` ## Test the Maven artifacts {#test-maven} @@ -630,44 +630,44 @@ Then go to the `<url>` declaration of <repository>` each block and replace value of the temporary Maven repository created by Nexus. Usually, only the 3 last digits need to be updated. -{{< highlight bash >}} +```bash cd $SIS_RC_DIR/../release/test/maven # Edit <url> in pom.xml before to continue. mvn compile svn commit -m "Test project for SIS $NEW_VERSION-RC$RELEASE_CANDIDATE" -{{< / highlight >}} +``` Clear the local Maven repository in order to force downloads from the Nexus repository, then test. This will also verify the checksums. -{{< highlight bash >}} +```bash rm -r $SIS_DATA/* rm -r ~/.m2/repository/org/apache/sis mvn package --show-version --strict-checksums -{{< / highlight >}} +``` Verify that the EPSG dataset has been created, then cleanup: -{{< highlight bash >}} +```bash du --summarize --human-readable $SIS_DATA/Databases/SpatialMetadata mvn clean -{{< / highlight >}} +``` ## Test the downloads {#test-downloads} Stage the release candidate: -{{< highlight bash >}} +```bash cd $DIST_DIR svn add apache-sis-$NEW_VERSION-* cd ../.. svn commit --message "SIS $NEW_VERSION release candidate $RELEASE_CANDIDATE" -{{< / highlight >}} +``` Execute the following commands in any temporary directory for testing the sources: -{{< highlight bash >}} +```bash wget https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION/RC$RELEASE_CANDIDATE/apache-sis-$NEW_VERSION-src.zip \ https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION/RC$RELEASE_CANDIDATE/apache-sis-$NEW_VERSION-src.zip.asc # Test @@ -675,11 +675,11 @@ gpg --verify apache-sis-$NEW_VERSION-src.zip.asc unzip apache-sis-$NEW_VERSION-src.zip cd apache-sis-$NEW_VERSION-src gradle assemble -{{< / highlight >}} +``` Execute the following commands in any temporary directory for testing the binary: -{{< highlight bash >}} +```bash wget https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION/RC$RELEASE_CANDIDATE/apache-sis-$NEW_VERSION-bin.zip \ https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION/RC$RELEASE_CANDIDATE/apache-sis-$NEW_VERSION-bin.zip.asc # Test @@ -689,7 +689,7 @@ cd apache-sis-$NEW_VERSION unset SIS_DATA ./bin/sis about --verbose ./bin/sis crs https://raw.githubusercontent.com/apache/sis/main/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/crs/ProjectedCRS.xml --format WKT -{{< / highlight >}} +``` # Prepare Web site {#prepare-website} @@ -708,7 +708,7 @@ Update the following files (e.g. the release date in `index.md`): Execute `hugo` and browse the documentation in the `public` repository. If okay, commit and copy to staging repository: -{{< highlight bash >}} +```bash git commit --message "Prepare documentation for the $NEW_VERSION release." # Copy to staging repository @@ -725,7 +725,7 @@ find . -name "*.xml" -type f -exec sed -i 's/[[:space:]]*$//' '{}' \; git add --all git commit --message "Staging repository for the $NEW_VERSION release." git push -{{< / highlight >}} +``` The new web site will be published in the [staging area](https://sis.staged.apache.org/). It will not yet be published on `https://sis.apache.org`. @@ -749,15 +749,15 @@ It will not yet be published on `https://sis.apache.org`. Reply to the initial vote email and prepend to the original subject: -{{< highlight text >}} +``` [CANCELED] -{{< / highlight >}} +``` Delete the svn tag created by the release:perform step: -{{< highlight bash >}} +```bash svn delete https://svn.apache.org/repos/asf/sis/tags/$NEW_VERSION --message "deleting tag from rolled back release" -{{< / highlight >}} +``` Drop the Nexus staging repository: @@ -779,21 +779,21 @@ Check in the source and binary artifacts into distribution svn which will be pul The `dist/dev` svn is not mirrored, but the `dist/release` is. From any directory: -{{< highlight bash >}} +```bash svn move https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION/RC$RELEASE_CANDIDATE \ https://dist.apache.org/repos/dist/release/sis/$NEW_VERSION \ --message "Committing SIS Source and Binary Release Candidate $RELEASE_CANDIDATE for SIS-$NEW_VERSION." svn delete https://dist.apache.org/repos/dist/dev/sis/$NEW_VERSION \ --message "Delete SIS $NEW_VERSION staging repository after release." -{{< / highlight >}} +``` Verify release signatures. Download all source and binary artifacts into a new directory, then execute in that directory: -{{< highlight bash >}} +```bash find . -name "*.asc" -exec gpg --verify '{}' \; -{{< / highlight >}} +``` The output shall report only good signatures. @@ -820,10 +820,10 @@ The output shall report only good signatures. Delete the prior version: -{{< highlight bash >}} +```bash svn delete https://dist.apache.org/repos/dist/release/sis/$OLD_VERSION \ --message "Archive SIS-$OLD_VERSION after release of SIS-$NEW_VERSION." -{{< / highlight >}} +``` # Update main branch for the next development cycle {#next-release} diff --git a/content/source.md b/content/source.md index 07f511ea..341f6945 100644 --- a/content/source.md +++ b/content/source.md @@ -26,7 +26,7 @@ Replace that name in the shell commands below if another name is used. The Apache {{% SIS %}} source code can be cloned in that directory as below (lines starting with `#` are comments and can be ignored): -{{< highlight bash >}} +```bash mkdir ApacheSIS cd ApacheSIS git clone https://gitbox.apache.org/repos/asf/sis @@ -36,7 +36,7 @@ git clone https://gitbox.apache.org/repos/asf/sis # # or Subversion (read-only): # svn checkout https://github.com/apache/sis/trunk -{{< / highlight >}} +``` If JavaFX is available on the local machine, its JAR files location can be specified as below @@ -45,20 +45,20 @@ The JavaFX application is excluded by default because it depends on the [JavaFX platform][JavaFX] which is distributed under GPL license (note that the SIS module stay under Apache 2 licence). -{{< highlight bash >}} +```bash # Syntax for Unix shell export PATH_TO_FX=/usr/lib/jvm/openjfx -{{< / highlight >}} +``` Likewise the [EPSG geodetic dataset](epsg.html) is excluded by default for licensing reasons. Then, Apache {{% SIS %}} can be built as below: -{{< highlight bash >}} +```bash cd sis gradle assemble gradle publishToMavenLocal # If use with Maven projects is desired. -{{< / highlight >}} +``` Outputs will be located in the following sub-directories: @@ -85,7 +85,7 @@ That directory is specified by the `SIS_DATA` environment variable and can be lo A convenient location is a subdirectory of the `ApacheSIS` directory created in the "basic checkout" section. For example (with `ApacheSIS` as the current directory): -{{< highlight bash >}} +```bash mkdir Data export SIS_DATA=$PWD/Data # @@ -94,7 +94,7 @@ export SIS_DATA=$PWD/Data # file in user home directory. # echo export SIS_DATA=$SIS_DATA -{{< / highlight >}} +``` ## Checkout non-free data {#non-free} @@ -107,16 +107,16 @@ but this section describes an alternative way more suitable to Apache {{% SIS %} Before to continue, make sure to agree with [EPSG terms of use][EPSG-ToU]. Then following command can be executed with `ApacheSIS` as the current directory: -{{< highlight bash >}} +```bash # Executing this command imply agreement with EPSG terms of use. svn checkout https://svn.apache.org/repos/asf/sis/data/non-free/ -{{< / highlight >}} +``` Then copy or link the EPSG scripts in the directory where Apache {{% SIS %}} looks for optional data. Adjust the relative paths as needed if the `SIS_DATA` environment variable points to another location than the one used in above section: -{{< highlight bash >}} +```bash mkdir $SIS_DATA/Databases mkdir $SIS_DATA/Databases/ExternalSources cd $SIS_DATA/Databases/ExternalSources @@ -124,7 +124,7 @@ ln -s ../../../non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/f ln -s ../../../non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/FKeys.sql EPSG_FKeys.sql ln -s ../../../non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Tables.sql EPSG_Tables.sql cd - -{{< / highlight >}} +``` This is sufficient for allowing Apache {{% SIS %}} to create the geodetic database without the need for `sis-epsg` or `sis-embedded-data` module on the classpath. @@ -153,32 +153,32 @@ because Apache {{% SIS %}} always delete the temporary schema after tests comple regardless if the tests were successful or not. The role and database can be created by connecting to the server: -{{< highlight bash >}} +```bash psql --username=postgres -{{< / highlight >}} +``` Then the role and database can be created by the following SQL instructions (replace `my_unix_user_name` by your actual user name): -{{< highlight sql >}} +```sql CREATE ROLE my_unix_user_name LOGIN; CREATE DATABASE "SpatialMetadataTest" WITH OWNER = my_unix_user_name; COMMENT ON DATABASE "SpatialMetadataTest" IS 'For Apache SIS tests only.'; \connect "SpatialMetadataTest" CREATE EXTENSION postgis; \q -{{< / highlight >}} +``` For opening access to that database without password, it may be necessary to add following line (ignoring comment lines) in the `pg_hba.conf` file. Location of this file is system-dependent, it may be `/var/lib/pgsql/data/`. The following lines should be inserted *before* the lines for user `all`: -{{< highlight text >}} +``` # TYPE DATABASE USER ADDRESS METHOD host SpatialMetadataTest my_unix_user_name 127.0.0.1/32 trust host SpatialMetadataTest my_unix_user_name ::1/128 trust -{{< / highlight >}} +``` The last step for allowing Apache {{% SIS %}} to run tests on PostgreSQL is to set the `org.apache.sis.test.extensive` Java property to `true` (see next section). @@ -195,10 +195,10 @@ the `sis` directory (for example writing in `SpatialMetadataTest` database on Po or because those tests take a long time to execute. For enabling all tests, use the following command: -{{< highlight bash >}} +```bash cd sis gradle test --system-prop org.apache.sis.test.extensive=true -{{< / highlight >}} +``` ## Switch to development branch {#branches} @@ -219,10 +219,10 @@ Developments on `geoapi-4.0` branch are merged to `geoapi-3.1` branch, which is When commits reach `main` they become unmodifiable; the `git push --force` command is not allowed on that branch. Contributors to Apache {{% SIS %}} project should switch to the current development branch before submitting patches: -{{< highlight bash >}} +```bash cd sis git checkout geoapi-4.0 -{{< / highlight >}} +``` Note that those `geoapi-xxx` branches may disappear or be replaced by something else after {{% OGC %}} releases the corresponding GeoAPI versions.