Ticket #2807 (new enhancement)

Opened 5 years ago

Last modified 5 years ago

overriding worldfile with GDAL

Reported by: mko Owned by: wamerdam
Priority: normal Milestone:
Component: GDAL Support Version: 5.2
Severity: normal Keywords:
Cc: m.kofahl@…

Description

In 5.2.0 there's a new processing instruction in 5.2.0 'EXTENT_PRIORITY=WORLDFILE'. In rare cases (read only volumes with tiffs without tfw) one may even have to specify another path where the tfw resides.

A workaround uses a new processing instruction 'WORLDFILE' which can be set in the mapfile 'PROCESSING "WORLDFILE=/tmp/file.tfw"'. msGetGDALGeoTransform():

/* -------------------------------------------------------------------- */
/*      Do we want to override GDAL with a worldfile if one is present? */
/* -------------------------------------------------------------------- */

... EXTENT_PRIORITY ...

    worldfile = CSLFetchNameValue( layer->processing,
                                   "WORLDFILE" );

    if( worldfile != NULL
        && msBuildPath(szPath, map->mappath, worldfile) != NULL
        && strrchr(szPath,'.') != NULL )
    {
         char *extension = strdup(strrchr(szPath,'.')+1);
         strrchr(szPath,'.')[0] = '\0';

         if( GDALReadWorldFile(szPath, extension,
                                 padfGeoTransform) )
         {
            msDebug("msGetGDALGeoTransform(): Using alternative worldfile %s.%s\n", szPath, extension);
            return MS_SUCCESS;
         }
    }

One may combine it with EXTENT_PRIORITY.

Attachments

mapdrawgdal.patch Download (1.4 KB) - added by mko 4 years ago.
supports multiple world files

Change History

Changed 5 years ago by sdlime

  • owner changed from sdlime to wamerdam
  • component changed from MapServer C Library to GDAL Support

Changed 4 years ago by mko

supports multiple world files

Note: See TracTickets for help on using tickets.