| 1 | [[PageOutline]] |
| 2 | = GDAL Raster Provider for MapGuide 4.0 = |
| 3 | |
| 4 | This page provides installation and configuration tips for the !GDAL Raster Provider for MapGuide Open Source 4.0. This document is a work in progress. Please post any feedback on this document to the mapguide-users list. |
| 5 | |
| 6 | == Introduction == |
| 7 | |
| 8 | '''IMPORTANT: These notes apply for MapGuide 4.0 Preview 3 and newer releases going forward. For Preview 2 and older releases, refer to the [wiki:MGOS311GdalProvider previous version of these notes]''' |
| 9 | |
| 10 | The default GDAL FDO provider provided by MapGuide 4.0 is built against '''GDAL 2.4.4''' using its standard driver profile. That is to say of the drivers listed here: |
| 11 | |
| 12 | * http://www.gdal.org/formats_list.html |
| 13 | * http://gdal.org/ogr_formats.html |
| 14 | |
| 15 | The default GDAL FDO provider will only support the drivers where '''Compiled by default''' is unconditionally '''Yes''' |
| 16 | |
| 17 | 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 [http://www.gisinternals.com/ GISInternals] on the [http://www.gisinternals.com/stable.php stable channel]. Be sure to retain a copy of this download for future installs of 4.0 as GISInternals may rollover to a new GDAL version at any time |
| 18 | |
| 19 | For the version of FDO that ships with MapGuide Open Source 4.0, the GDAL, OGR and WMS FDO providers have been refactored to use the GDAL/OGR C API for better ABI stability. What this means now (unlike previous versions of MapGuide), is that you should now be able to use replace our internal `gdal204.dll` with any external windows build of GDAL 2.4.4 regardless of the MSVC compiler version. |
| 20 | |
| 21 | But for the purpose of recommended practice, we still suggest you use MSVC 2015 build of GDAL 2.4.4. As of the writing of this page, the file in question is: |
| 22 | |
| 23 | * release-1900-x64-gdal-2-4-4-mapserver-7-4-3.zip |
| 24 | |
| 25 | == Additional Driver Support == |
| 26 | |
| 27 | Refer to the [https://gisinternals.com/query.html?content=filelist&file=release-1900-x64-gdal-2-4-4-mapserver-7-4-3.zip information page] of the distribution you downloaded for supported drivers. |
| 28 | |
| 29 | For more information about these formats, consult the respective [http://www.gdal.org/formats_list.html GDAL] and [http://gdal.org/ogr_formats.html OGR] driver format pages. |
| 30 | |
| 31 | == Licensing == |
| 32 | |
| 33 | '''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''' |
| 34 | |
| 35 | '''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''' |
| 36 | |
| 37 | == A note about environment variables == |
| 38 | |
| 39 | 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: |
| 40 | |
| 41 | * 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. |
| 42 | * 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. |
| 43 | |
| 44 | Wherever this guide refers to setting an environment variable, it is through one of these two methods. |
| 45 | |
| 46 | == Installation == |
| 47 | |
| 48 | Extract the contents of the `bin` directory within this zip distribution to the FDO directory of your MapGuide installation, which by default is: |
| 49 | |
| 50 | {{{ |
| 51 | C:\Program Files\OSGeo\MapGuide\Server\FDO |
| 52 | }}} |
| 53 | |
| 54 | If prompted, overwrite any existing files. The files that you'll generally be prompted to overwrite include: |
| 55 | |
| 56 | * `gdal204.dll` (obviously) |
| 57 | * `libeay32.dll` |
| 58 | * `ssleay32.dll` |
| 59 | * `libpq.dll` |
| 60 | |
| 61 | Then set the following environment variables: |
| 62 | |
| 63 | * {{{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) |
| 64 | * {{{GDAL_DATA}}} that points to the extracted `gdal-data` directory. Certain GDAL/OGR drivers will be reading data from files in this directory and you need this environment variable set to tell GDAL/OGR where to look. |
| 65 | |
| 66 | 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 the `gdalinfo` and `ogrinfo` tools (provided with the gisinternals zip distribution) 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. |
| 67 | |
| 68 | == Debugging == |
| 69 | |
| 70 | The {{{CPL_DEBUG}}} environment variable controls whether GDAL and its plugins will output extra debug information when the MapGuide server process is running. |
| 71 | |
| 72 | 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. |
| 73 | |
| 74 | The moment the GDAL provider starts making GDAL API calls, you should see output like this start showing up in the console output^1. |
| 75 | |
| 76 | {{{ |
| 77 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW.dll using GDALRegister_ECW. |
| 78 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW. |
| 79 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_MrSID.dll using GDALRegister_MrSID. |
| 80 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW.dll using GDALRegister_ECW. |
| 81 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_ECW_JP2ECW.dll using GDALRegister_ECW_JP2ECW. |
| 82 | GDAL: Auto register C:\Program Files\OSGeo\MapGuide\Server\bin\gdalplugins\gdal_MrSID.dll using GDALRegister_MrSID. |
| 83 | MrSID: Opened zoom level 1 with size 2500x2500. |
| 84 | MrSID: Opened zoom level 2 with size 1250x1250. |
| 85 | MrSID: Opened zoom level 3 with size 625x625. |
| 86 | MrSID: Opened zoom level 4 with size 313x313. |
| 87 | MrSID: Opened zoom level 5 with size 157x157. |
| 88 | MrSID: Opened zoom level 6 with size 79x79. |
| 89 | MrSID: Opened zoom level 7 with size 40x40. |
| 90 | MrSID: Opened zoom level 0 with size 5000x5000. |
| 91 | MrSID: Opened image: width 5000, height 5000, bands 3 |
| 92 | GDAL: GDALOpen(D:\projects\Client\Data\SDF/DO_S03_9608_40.sid, this=0FB15438) succeeds as MrSID. |
| 93 | GDAL: GDALClose(, this=0FB15D18) |
| 94 | GDAL: GDALClose(, this=0FB16088) |
| 95 | GDAL: GDALClose(, this=0FB16410) |
| 96 | GDAL: GDALClose(, this=0FB16798) |
| 97 | GDAL: GDALClose(, this=0FB16B20) |
| 98 | GDAL: GDALClose(, this=0FB16EA8) |
| 99 | GDAL: GDALClose(, this=0FB17230) |
| 100 | GDAL: GDALClose(D:\projects\Client\Data\SDF/DO_S03_9608_40.sid, this=0FB15438 |
| 101 | }}} |
| 102 | |
| 103 | ^1 This is just example output (copied from the GDAL provider guide for 2.2) showing the kind of output you would see. |
| 104 | |
| 105 | Remember to unset `CPL_DEBUG` when finished as performance is significantly slower when GDAL debugging is turned on. |
| 106 | |
| 107 | == Configuration == |
| 108 | |
| 109 | The default `serverconfig.ini` settings set by the installer should be sufficient. No additional `serverconfig.ini` modifications are required. |
| 110 | |
| 111 | In addition to {{{CPL_DEBUG}}}, GDAL offers many other runtime configuration options via environment variables. [https://trac.osgeo.org/gdal/wiki/ConfigOptions See here for the full list] |
| 112 | |
| 113 | == Previous notes == |
| 114 | |
| 115 | * [wiki:MGOS311GdalProvider GDAL Raster Provider for MapGuide 3.1.1] |
| 116 | * [wiki:MGOSGdalProviderFor26And30 GDAL Provider tips for MapGuide 3.0 and 2.6] |
| 117 | * [wiki:MGOS22GdalProvider GDAL Provider tips for MapGuide 2.2] |