Sorry for the late reply.
Does that apply to other Python modules as well, or just pyGPlates ? If it’s just a problem with pyGPlates, then that might be because you can’t currently install with pip
(as in pip install pygplates
), but that will be supported in the next pyGPlates release (very soon). However you can currently install pygplates using conda
. But I’m not sure if any of this is useful in the ArcGIS environment or not.
You are right in that pyGPlates is a wrapper around GPlates, but it wraps its internal functionality. The GPlates functionality is mostly accessible through the graphical user interface - and since that’s not programmable, the only other way to access it is through the GPlates command-line interface - which is much more limited (but still useful since projects like rgplates use it).
PyGPlates also makes the internal functionality more accessible to end users (by designing and documenting an abstraction layer around it, making it easier to use). To access the internal functionality directly (ie, via the C++ source code instead of via pyGPlates) would require a higher level of understanding of the GPlates C++ code base - which, while it was (and continues to be) well-designed, it is still not something to be taken lightly (ie, needs a fairly significant investment in time to get up to speed with).
Yes, GDAL >= 3.5 uses CMake, but I had link errors using it, so I just used GDAL 3.4.3 instead for now (ie GDAL < 3.5).
I’ve updated the build instructions (will be in next release). Here is the section relevant to GDAL:
GDAL
1. Get GDAL 3.x source code from https://github.com/OSGeo/gdal/releases
2. Extract to a location on your hard drive (eg, "C:\SDK\GDAL\gdal-3.8.3").
3. Read the instructions for compiling and installing GDAL.
GDAL >= 3.5 uses CMake (see https://gdal.org/development/building_from_source.html).
GDAL < 3.6 uses nmake (see https://trac.osgeo.org/gdal/wiki/BuildingOnWindows).
Note that currently building GDAL >= 3.5 (eg, 3.8.3) results in a link error concerning hdf5-shared.lib (which is meant to be a CMake target, no library).
So currently we just use GDAL 3.4.3.
For GDAL >= 3.5 this involves:
o Create a 'build' sub-directory inside your extracted proj source directory (eg, "C:\SDK\GDAL\gdal-3.8.3\build\") and step into it:
mkdir build
cd build
o Configure for building:
Here we use Visual Studio 2019 ('-G "Visual Studio 16 2019"') in 64-bit mode ('-A x64').
We set the GDAL install path using '-D CMAKE_INSTALL_PREFIX ...' a directory that is different than the root of the extracted source tree.
For example, "C:\SDK\GDAL\gdal-3.8.3\msvc2019_64". This ensures GPlates/pyGPlates will find the correct GDAL CMake config files (the ones created when installing GDAL).
You can specify the Proj/NetCDF/SQLite3 include/library/exe locations using '-D CMAKE_PREFIX_PATH ...'.
Note that if they are already in the CMAKE_PREFIX_PATH or PATH environment variables then this is not necessary.
And the final '..' tells CMake the root location of the source tree (ie, parent directory of 'build').
cmake -G "Visual Studio 16 2019" -A x64 \
-D CMAKE_INSTALL_PREFIX:PATH=C:\SDK\GDAL\gdal-3.8.3\msvc2019_64 \
-D GDAL_USE_SQLITE3:BOOL=ON \
-D GDAL_USE_NETCDF:BOOL=ON \
..
o Build GDAL (as a release build):
cmake --build . --config Release
o Install GDAL (into the CMAKE_INSTALL_PREFIX location specified above):
cmake --build . --config Release --target install
For GDAL < 3.6 this involves:
o Edit the "nmake.opt" file under the section labelled "# Uncomment the following to enable NetCDF format.",
- Uncomment the following four lines and specify the location of the NetCDF library (see NetCDF above).
- For example, after editing, you might have something like:
NETCDF_PLUGIN = NO
NETCDF_SETTING=yes
NETCDF_LIB=C:\SDK\NetCDF\netcdf-4.9.2\lib\netcdf.lib
NETCDF_INC_DIR=C:\SDK\NetCDF\netcdf-4.9.2\include
o Edit the "nmake.opt" by uncommenting '#NETCDF_HAS_NC4 = yes':
- This enables NetCDF version 4 support (which uses HDF5).
- For example, after editing, you should have:
NETCDF_HAS_NC4 = yes
o Edit the "nmake.opt" file under the section labelled "# PROJ stuff (required dependency: PROJ >= 6)",
- Uncomment the following two lines and specify the location of the PROJ library (see PROJ above).
- For example, after editing, you might have something like:
PROJ_INCLUDE = -IC:\SDK\PROJ\proj-9.3.1\msvc2019_64\include
PROJ_LIBRARY = C:\SDK\PROJ\proj-9.3.1\msvc2019_64\lib\proj.lib
o Edit the "nmake.opt" file under the section labelled "SQLite Libraries",
- Uncomment the following two lines and specify the location of the SQLite3 library (see SQLite3 above).
- For example, after editing, you might have something like:
SQLITE_INC=-Ic:\SDK\SQLite\sqlite-amalgamation-3450000
SQLITE_LIB=c:\SDK\SQLite\sqlite-amalgamation-3450000\sqlite3_i.lib
Note that we're not using the spatialite extension to SQLite which would require installing the spatialite amalgamation
(instead the SQLite3 amalgamation) and also specifying the '-DHAVE_SPATIALITE' and '-DSPATIALITE_AMALGAMATION' flags in 'SQLITE_INC'.
o Start a Visual Studio command prompt (64-bit).
Run 'nmake /f makefile.vc' with options specifying compiler, 64 bit and the install prefix.
For example, to compile using Visual Studio 2019 as 64-bit and install into the "msvc2019_64" sub-directory of source code root, type:
nmake /f makefile.vc MSVC_VER=1929 WIN64=1 GDAL_HOME=C:\SDK\GDAL\gdal-3.4.3\msvc2019_64 devinstall
- If 'MSVC_VER' is not specified it appears (in "nmake.opt") to default to 1900 (Visual Studio 2015). At least for GDAL 2.3 (and still there for 3.3).
Above we specify MSVC_VER=1929 which corresponds to Visual Studio 2019 version 16.10 (and 16.11).
- 'WIN64=1' specifies a 64-bit build.
- 'GDAL_HOME' specifies the install location.
For example, "C:\SDK\GDAL\gdal-3.4.3\msvc2019_64" specifies the "msvc2019_64" sub-directory of the source code root "C:\SDK\GDAL\gdal-3.4.3".
- If you want a debug build then add 'DEBUG=1'.
NOTE: It appears both debug and release builds use the same filenames (so they just overwrite each other).
Might need to pick one or the other.
- The 'devinstall' target ensures the libraries and include files are installed (in addition to GDAL executables and data from 'install' target).
4. Add the *install* 'bin' directory to the PATH environment variable (eg, "C:\SDK\GDAL\gdal-3.8.3\msvc2019_64\bin" or "C:\SDK\GDAL\gdal-3.4.3\msvc2019_64\bin").
This is so the GDAL DLL can be found at run-time.
5. Add the GDAL *install* directory to the CMAKE_PREFIX_PATH environment variable (eg, "C:\SDK\GDAL\gdal-3.8.3\msvc2019_64" or "C:\SDK\GDAL\gdal-3.4.3\msvc2019_64").
This enables CMake to find GDAL when configuring GPlates/pyGPlates (see BUILD.Windows).
Note that this is not strictly necessary since CMake can find the GDAL install prefix using the PATH environment variable (CMake strips off 'bin').
6. Set the GDAL_HOME environment variable to the installed GDAL directory (eg, "C:\SDK\GDAL\gdal-3.8.3\msvc2019_64" or "C:\SDK\GDAL\gdal-3.4.3\msvc2019_64").
This enables GPlates to deploy GDAL plugins.
7. Set the GDAL_DATA environment variable to the installed GDAL data directory (eg, "C:\SDK\GDAL\gdal-3.8.3\msvc2019_64\data" or "C:\SDK\GDAL\gdal-3.4.3\msvc2019_64\data").
This enables GDAL to find its resource data.
NOTE that GDAL 2.3 (and above) use C++11 features which requires Visual Studio 2015 (or above).