GDAL Raster Provider for MapGuide 2.6 and 3.0
This page provides installation and configuration tips for the !GDAL Raster Provider for MapGuide Open Source 2.6 and 3.0. This document is a work in progress. Please post any feedback on this document to the mapguide-users list.
The default GDAL FDO provider provided by MapGuide 2.6 and 3.0 is built using the standard driver profile of GDAL 1.10. That is to say of the drivers listed here:
The default GDAL FDO provider will only support the drivers where Compiled by default is unconditionally Yes
To support additional raster/vector formats, you need to source an alternate binary build of GDAL/OGR. Usually the place to get such alternate GDAL/OGR binaries is at GISInternals
Unfortunately, due to the nature of C++ code (MapGuide, FDO and GDAL all being written in it), you must make sure to download the GDAL/OGR package that is built with the same MSVC compiler used to build MapGuide Open Source 2.6 and 3.0 which is MSVC 2012.
Sadly, GISInternals does not offer a binary of GDAL 1.10 built with MSVC 2012, meaning this option of using custom GDAL binaries not possible.
Fortunately, GISInternals offers a Development Kit that allows us to build our own custom GDAL binaries using MSVC 2012.
Jackie Ng has made available a custom build of GDAL 1.10 with additional raster and vector format support thanks to the availability of this GISInternals Development Kit:
- GDAL 1.10 for MapGuide Open Source 2.6/3.0 32-bit
- GDAL 1.10 for MapGuide Open Source 2.6/3.0 64-bit
Additional Driver Support
This custom build of GDAL 1.10 offers support for the following additional raster formats:
ECW (rw): ERDAS Compressed Wavelets (SDK 3.x) JP2ECW (rw+v): ERDAS JPEG2000 (SDK 3.x) FITS (rw+): Flexible Image Transport System GMT (rw): GMT NetCDF Grid Format netCDF (rw+s): Network Common Data Format WCS (rovs): OGC Web Coverage Service WMS (rwvs): OGC Web Map Service HTTP (ro): HTTP Fetching Wrapper Rasterlite (rws): Rasterlite PostGISRaster (rws): PostGIS Raster driver MBTiles (rov): MBTiles
And support for the following additional vector formats:
-> "PostgreSQL" (read/write) -> "NAS" (readonly) -> "LIBKML" (read/write) -> "Interlis 1" (read/write) -> "Interlis 2" (read/write) -> "SQLite" (read/write) -> "VFK" (readonly) -> "OSM" (readonly) -> "WFS" (readonly) -> "GFT" (read/write) -> "CouchDB" (read/write) -> "ODS" (read/write) -> "XLSX" (read/write) -> "ElasticSearch" (read/write) -> "PDF" (read/write)
NOTICE: Due to licensing terms that prevent redistribution of development libraries, the raster/vector format support in this custom build of GDAL is not the same as the GDAL binaries made available on GISInternals. In particular, the Development Kit does not contain the libraries needed to build GDAL with support for the following formats:
- Oracle OCI
Also, the Development Kit targets GDAL 1.11 instead of GDAL 1.10. As a result, certain build configuration parameters are not applicable or invalid when using the DevKit to build against GDAL 1.10, meaning support for the following formats have been omitted as well:
- JP2OpenJPEG (GDAL 1.10 requires OpenJPEG 2.0, the DevKit bundles OpenJPEG 2.1 that GDAL 1.11 requires)
- MySQL (assorted compiler/linker errors when building against GDAL 1.10)
NOTICE: ECW Technology must be licensed from ERDAS if it used in a server application like MapGuide. Please see the following link for information on the licensing. http://iws.erdas.com/gis/can-i-use-ecw-technology-in-my-third-party-server.aspx
NOTICE: Additional plugins and libraries included in this distribution may be under radically different licenses, you MUST obtain valid licenses for each of these dependent libraries. License information for such plugins and libraries can be found in RTF format on the GISInternals buildsystem repository on GitHub: https://github.com/gisinternals/buildsystem
A note about environment variables
GDAL has various configuration options which are driven through environment variables. For the GDAL FDO provider to properly incorporate these environment variables, you have to do one of the following:
- Set the environment variables in question through the Computer properties dialog. This will probably also require a reboot so that MapGuide can pick these environment variables up when running in service mode. These variables will stick until they are unset from the Computer properties dialog.
- Set these environment variables from a command line and then run MapGuide afterwards from the same session in interactive mode (
mgserver run). To simplify this, you could wrap the setting of the environment variables and the running of MapGuide in interactive mode as a batch file and run that. These variables will stick for the duration of the command-line session that you run MapGuide in.
Wherever this guide refers to setting an environment variable, it is through one of these two methods.
Unzip the zip distribution to the FDO directory of your MapGuide installation, which by default is:
If prompted, overwrite any existing files.
Then set an environment named
GDAL_DRIVER_PATH that points to the new
gdalplugins under your FDO directory (NOTE: In previous versions of this guide, it told you to have the gdalplugins directory under the MapGuide Server's bin directory. The change of instructions here is to allow both FDO and the included set of GDAL/OGR console applications to be able to load these GDAL/OGR plugins)
Make sure that mapguide is reading the correct co-ordinate system is being read from the source files, override it if necessary. You can use gdalinfo and ogrinfo to get the true extents and coordinate systems of your datasets should MapGuide and FDO fail to properly infer this information, though in such cases indicates a defect in the GDAL or OGR provider should it fail to return this information where gdalinfo or ogrinfo does.
CPL_DEBUG environment variable controls whether GDAL and its plugins will output extra debug information when the MapGuide server process is running.
GDAL debug output is written to the standard output stream (stdout), so its best to use
CPL_DEBUG in conjunction with running MapGuide server in interactive mode, as there is no visible stdout when MapGuide runs as a service.
The moment the GDAL provider starts making GDAL API calls, you should see output like this start showing up in the console output1.
GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW.dll using GDALRegister_ECW. GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW. GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_MrSID.dll using GDALRegister_MrSID. GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW.dll using GDALRegister_ECW. GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW. GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_MrSID.dll using GDALRegister_MrSID. MrSID: Opened zoom level 1 with size 2500x2500. MrSID: Opened zoom level 2 with size 1250x1250. MrSID: Opened zoom level 3 with size 625x625. MrSID: Opened zoom level 4 with size 313x313. MrSID: Opened zoom level 5 with size 157x157. MrSID: Opened zoom level 6 with size 79x79. MrSID: Opened zoom level 7 with size 40x40. MrSID: Opened zoom level 0 with size 5000x5000. MrSID: Opened image: width 5000, height 5000, bands 3 GDAL: GDALOpen(D:\projects\Client\Data\SDF/DO_S03_9608_40.sid, this=0FB15438) succeeds as MrSID. GDAL: GDALClose(, this=0FB15D18) GDAL: GDALClose(, this=0FB16088) GDAL: GDALClose(, this=0FB16410) GDAL: GDALClose(, this=0FB16798) GDAL: GDALClose(, this=0FB16B20) GDAL: GDALClose(, this=0FB16EA8) GDAL: GDALClose(, this=0FB17230) GDAL: GDALClose(D:\projects\Client\Data\SDF/DO_S03_9608_40.sid, this=0FB15438
1 This is just example output (copied from the GDAL provider guide for 2.2) showing the kind of output you would see. Just remember there's no MrSID driver support in this custom build of GDAL.
Remember to unset CPL_DEBUG when finished as performance is significantly slower when GDAL debugging is turned on.
The default serverconfig.ini settings set by the installer should be sufficient. No additional serverconfig.ini modifications are required.
In addition to
CPL_DEBUG, GDAL offers many other runtime configuration options via environment variables. See here for the full list