AGG support

From Ka-Map Wiki

Jump to: navigation, search

If you have a Mapserver version > 5.0 then you are supposed to have AGG libraries available in your server.

to enable in your ka-Map version 1.0:

///////////////// in the .map file: /////////////////

OUTPUTFORMAT
 NAME 'AGGA'
 DRIVER AGG/PNG
 IMAGEMODE RGBA
# FORMATOPTION "TRANSPARENT=ON"
END

and also for the relevant LAYER:

LAYER
  METADATA
     "IMAGEFORMAT" "AGGA"
  END
.....
END

/////// in config php (around line 105): /////////////////

 $aszGMap = array (
        'title' => 'GMap 75',
        'path' => '../../gmap/htdocs/gmap_AGGA.map',
        'scales' => array( 40000000, 25000000, 12000000, 7500000,3000000, 1000000 ),
        'format' =>'PNG'  /// 
 );

and (around line 210):

      case "AGGA":
          $GLOBALS['szMapImageFormat'] = 'AGGA';
          $GLOBALS['szMapImageCreateFunction'] = "imagecreatefrompng";
          $GLOBALS['szImageExtension'] = '.png';
          $GLOBALS['szImageCreateFunction'] = "imagecreatetruecolor";
          $GLOBALS['szImageOutputFunction'] = "imagepng";
          $GLOBALS['szImageHeader'] = 'image/png';
          break;


/////// in tile.php (around line 85): /////////////////

$useAlphaCh = false;
if (isset($_REQUEST['i'])) {
   setOutputFormat( $_REQUEST['i'] );
   if (strtoupper($_REQUEST['i']) == 'ALPHA') {
   	$useAlphaCh = true;
   }
   elseif (strtoupper($_REQUEST['i']) == 'AGGA') {    /// <-- also use AlphaCh if AGGA
	$useAlphaCh = true;
  }
}

and lastly the fix from Paul (around line 315):

if ($useAlphaCh) {
    imageAlphaBlending($oTile, false);
    imagefill($oTile, 0, 0, imagecolorallocatealpha($oTile, 0, 0, 0, 127));
    imageSaveAlpha($oTile, true);  	
}
Personal tools