Migrate from GeoTools to Geotoolkit

The Geotoolkit migrate module provides a tool to perform the straightforward changes to a Java code base to migrate that Java code from GeoTools to Geotoolkit.org. This helper tools renames classes and packages but does not handle changes in method signature. Once this tool is run, there will likely be remaining changes which will have to be ported by hand.

The tool makes the following changes. For every occurence of:

  • import org.geotools.gt.GT

where gt is any GeoTools package and GT is any GeoTools class in that package, then if and only if that particular GT class has been ported to Geotoolkit, the following is applied:

  1. The above statement is replaced by:
    • import org.geotoolkit.gto.GTO

    where gto and GTO are usually identical to the above GeoTools names (gt and GT respectively), but not always. For example the package of WeakHashMap is org.geotools.util in GeoTools, but org.geotoolkit.util.collection in Geotk.

  2. Every occurence of the GT class name are replaced by the GTO class name in the source file. This operation does nothing in the common case where the class name is the same in Geotoolkit than in GeoTools.

Note that those changes apply to GeoTools classes only; the GeoAPI interfaces are the same. Any code that use only the GeoAPI interfaces should be able to switch smoothly between GeoTools and Geotk.

Usage

The latest JAR is available from the Maven repository. It can be saved in any directory. Once downloaded, the migration tools is launched as below:

cd [ROOT DIRECTORY OF SOURCE CODE]
java -jar [PATH TO THE JAR]/geotk-migrate.jar [OPTION]

where the [OPTION] can be:

  • --pretend Lists the files that would be changed but do not touch them.
  • --migrate Migrates GeoTools source code in place.

The migrated files will overwrite the old ones - make sure to backup your files before to run geotk-migrate with the --migrate option. Or yet better, run this tool in a SVN or Mercurial local repository, so the changes can easily be inspected and reverted if needed.

Notable changes.

See the summary of changes since GeoTools for an overview of conceptual changes.

See the common compiler errors for changes that can not be performed by the automatic tools. Those changes need to be applied manually.