EPSG pack

Compact the EPSG data script file. This module is used only when the geotk-epsg module needs to be updated for a new release of the EPSG database. This page describes the steps to follow.

  1. Download the latest SQL scripts for MySQL from the EPSG site.
  2. Unzip in the directory of your choice (replace "7.9" by the appropriate version number in the ZIP filename), and remember the path to that directory.
    unzip EPSG_v7_9_MySQL.zip
    cd EPSG_v7_9_MySQL
    export EPSG_SCRIPTS=$PWD
  3. Move to the directory which contain the Geotk scripts.
    export GEOTK_HOME=<declare your root Geotk source code directory here>
    cd $GEOTK_HOME/modules/referencing/geotk-epsg/src/main/resources/org/geotoolkit/referencing/factory/epsg/
  4. Overwrite Tables.sql and FKeys.sql with the new SQL scripts (replace "7.9" by the appropriate version number in the commands show below). Do not overwrite Data.sql and Indexes.sql.
    cp $EPSG_SCRIPTS/EPSG_v7_9.mdb_Tables_MySQL.sql Tables.sql
    cp $EPSG_SCRIPTS/EPSG_v7_9.mdb_FKeys_MySQL.sql  FKeys.sql
  5. Open the Tables.sql file for edition.
    • In the statement creating the epsg_datum table, change the type of the realization_epoch column to SMALLINT.
    • In the statement creating the coordinateaxis table, add the NOT NULL constraint to the coord_axis_code column.
    • In the statement creating the change table, remove the UNIQUE constraint on the change_id column and add a CONSTRAINT pk_change PRIMARY KEY (change_id) line instead.
    • Suppress trailing spaces and save.
  6. Open the FKeys.sql file for edition, suppress trailing spaces and save. In most cases this result in unmodified Tables.sql and FKeys.sql files compared to the previous version.
  7. Run the following command-lines (replace "7.9" by the appropriate version number to the files in the EPSG directory):
    ln $GEOTK_HOME/build/tools/geotk-epsg-pack/target/geotk-epsg-pack-3.x-SNAPSHOT.jar $GEOTK_HOME/target/binaries/
    java -jar $GEOTK_HOME/target/binaries/geotk-epsg-pack-3.x-SNAPSHOT.jar compact $EPSG_SCRIPTS/EPSG_v7_8.mdb_Data_MySQL.sql Data.sql
  8. Upgrade the VERSION value defined in the ThreadedEpsgFactory class, and the EPSG_VERSION value defined in the org.geotoolkit.test.Commons class (geotk-test module).
  9. Clean and build. Let Geotk creates the EPSG embedded database as part of the geotk-epsg test suite, and test again.
    cd $GEOTK_HOME
    mvn clean install
    mvn test
  10. Run org.geotoolkit.referencing.factory.epsg.SupportedListGenerator (available in the test directory of the geotk-referencing module) and copy the generated supported-codes.html file on the web server.