TransWikia.com

Using MapBasic, is there a method to compress GeoTIFF after programatically creating the GeoTIFF?

Geographic Information Systems Asked by MapinTX on January 1, 2021

I need to compress the file sizes of GeoTIFFs that are created when running the MapBasic application. In a .Net application, I transform the GeoTIFF into a compressed JPG using ImageMagick; which works perfectly. However, the original GeoTIFFs are required for sharing and download. Adding to the difficulty is that the existing resolution and dimensions must be maintained. I am trying to perform the compression within MapBasic so that an additional application just to compress the GeoTIFFs will not need to be created.

Here is a sample of the current code:

Save Window windowId As reportPath & imgFileName & ".tif" Type "GEOTIFF" Width 7.49826 Units "in" Height 9.5816 Unites "in" Resolution 1152

One Answer

Can you call batch files from MapBasic? I compress GeoTIFFs externally, using a command like the following: gdal_translate -co COMPRESS=JPEG -co JPEG_QUALITY=%QUALITY% -co PHOTOMETRIC=YCBCR -co TILED=YES You need input & output filenames/paths after that, which I don't show here. %QUALITY% is a variable I set up earlier, use from 75 to 100. I'm using the gdal_translate that comes with QGIS.

Answered by rossnixon on January 1, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP