[mapserver-users] PDF and SVG only shows last georeferenced raster layer

Anzel, Phil - Fort Collins, CO Phil.Anzel at ftc.usda.gov
Fri Jun 11 15:45:52 PDT 2010


Hi,

I think there is a defect when using multiple raster data layers with PDF or SVG image formats: only the last geo-referenced raster layer is drawn. This problem does not exist if the output is PNG.

To demonstrate this problem, retrieve two adjacent JPEG tile files from Microsoft's Virtual Earth, using URLs:
  (west tile) http://ecn.t0.tiles.virtualearth.net/tiles/r021323222.jpg?g=409&mkt=en-US&shading=hill&n=z
  (east tile) http://ecn.t0.tiles.virtualearth.net/tiles/r021323223.jpg?g=409&mkt=en-US&shading=hill&n=z
The tiles should be saved as files r021323222.jpg and r021323223.jpg, respectively.

Create world files to accompany these. For the west tile, create r021323223.wld:
305.748113140705
0.0000000000
0.0000000000
-305.748113140705
-11897270.5785311
5087648.60266133

For the east, create r021323223.wld:
305.748113140705
0.0000000000
0.0000000000
-305.748113140705
-11818999.0615671
5087648.60266133

Here is the map file, with the addition of a red outline around the west tile and a green outline around the east one:

  MAP
    IMAGETYPE png
    SIZE 512 256
    CONFIG 'PROJ_LIB' 'C:\ms4w\proj\nad\'
    PROJECTION 'init=epsg:3857' END  # Web Mercator
    EXTENT -11900270.578531099 5006377.08569731 -11737727.5446031 5090648.6026613303
    UNITS meters

    LAYER
      NAME 'left_tile'
      # retrieve from http://ecn.t0.tiles.virtualearth.net/tiles/r021323222.jpg?g=409&mkt=en-US&shading=hill&n=z
      data 'r021323222.jpg'
      type raster
      status on
    END

    LAYER
      NAME 'right_tile'
      # retrieve from http://ecn.t0.tiles.virtualearth.net/tiles/r021323223.jpg?g=409&mkt=en-US&shading=hill&n=z
      data 'r021323223.jpg'
      type raster
      status on
    END

    LAYER
      NAME 'left_outline'
      STATUS on
      TYPE line
      FEATURE     #...right edge shifted left 153 meters (about half a tile pixel)
        WKT 'LINESTRING(
          -11818999.0615671 5009377.08569731,
          -11897423.578531099 5009377.08569731,
          -11897423.578531099 5087648.60266133,
          -11818999.0615671 5087648.60266133,
          -11818999.0615671 5009377.08569731)'
      END
      CLASS
        STYLE
          COLOR 255 0 0
        END
      END
    END

    LAYER
      NAME 'right_outline'
      STATUS on
      TYPE line
      FEATURE   #...left edge shifted right 153 meters (about half a tile pixel)
        WKT 'LINESTRING(
          -11818846.0615671 5009377.08569731,
          -11740727.5446031 5009377.08569731,
          -11740727.5446031 5087648.60266133,
          -11818846.0615671 5087648.60266133,
          -11818846.0615671 5009377.08569731)'
      END
      CLASS
        STYLE
          COLOR 0 255 0
        END
      END
    END
  END

Note that for PNG output, both tiles are shown. If you change the image type to SVG or PDF, only the last raster layer, the east tile, is shown.

Is this a defect? Short of externally aggregating the source bitmaps into a single bitmap outside of MapServer, is there a possible workaround? Is this associated with failure of OPACITY to work with SVG and PDF?

I'm using MapServer version 5.6.3 (MS4W distribution) under Windows XP Pro 2002 SP3. The problem was demonstrated with use of the "drawmap.exe" command-line utility.

Thanks in advance.

- Phil Anzel




More information about the MapServer-users mailing list