[GRASS-SVN] r61450 - grass-addons/grass6/raster/r.out.mbtiles

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 29 12:59:40 PDT 2014


Author: hamish
Date: 2014-07-29 12:59:40 -0700 (Tue, 29 Jul 2014)
New Revision: 61450

Modified:
   grass-addons/grass6/raster/r.out.mbtiles/description.html
   grass-addons/grass6/raster/r.out.mbtiles/r.out.mbtiles
Log:
tweaks to allow working with larger geotiffs; ignore alpha layer when considering if tile is empty or not

Modified: grass-addons/grass6/raster/r.out.mbtiles/description.html
===================================================================
--- grass-addons/grass6/raster/r.out.mbtiles/description.html	2014-07-29 15:04:48 UTC (rev 61449)
+++ grass-addons/grass6/raster/r.out.mbtiles/description.html	2014-07-29 19:59:40 UTC (rev 61450)
@@ -31,6 +31,9 @@
 the tile creation with a higher <b>zoom</b> level. Afterwards you
 can combine the directories into a single tree and adjust the
 maxzoom and minzoom values in the mapurl file as needed.
+<p>
+Android users, note that the maximum filesize on SD cards is often 2 GB,
+depending on the filesystem used.
 
 
 <h2>EXAMPLE</h2>

Modified: grass-addons/grass6/raster/r.out.mbtiles/r.out.mbtiles
===================================================================
--- grass-addons/grass6/raster/r.out.mbtiles/r.out.mbtiles	2014-07-29 15:04:48 UTC (rev 61449)
+++ grass-addons/grass6/raster/r.out.mbtiles/r.out.mbtiles	2014-07-29 19:59:40 UTC (rev 61450)
@@ -170,7 +170,7 @@
 #    funny google merc projection first?
 
 if [ "$MAP_TYPE" = "raster" ] ; then
-   r.out.tiff -t input="$MAP_NAME" output="$TMP_GTIFF"
+   r.out.tiff -t input="$MAP_NAME" output="$TMP_GTIFF" compression=packbit
    #gdalwarp -s_srs "`g.proj -jf`" -t_srs EPSG:900913 -dstalpha "$TMP_GTIFF" "$TMP_GMERC"
    gdal_translate $QUIET -a_srs "`g.proj -jf`" "$TMP_GTIFF" "$TMP_GMERC"
 else
@@ -180,7 +180,12 @@
       exit 1
    fi
 
-   r.out.gdal input="$MAP_NAME" output="$TMP_GTIFF" format=GTiff
+   # note: if Tiff grows to > 4GiB you will need to set the BIGTIFF=YES createopt
+   #  (packbits compression is used to give you a bit more room before the limit)
+
+   r.out.gdal input="$MAP_NAME" output="$TMP_GTIFF" format=GTiff \
+      createopt="COMPRESS=PACKBITS,BIGTIFF=IF_SAFER"
+
    #gdalwarp -t_srs EPSG:900913 -dstalpha "$TMP_GTIFF" "$TMP_GMERC"
    mv "$TMP_GTIFF" "$TMP_GMERC"
 fi
@@ -444,7 +449,7 @@
 for file in `find . | grep '.png$'` ; do
      # check if image is empty
     COUNT=`gdalinfo -mm -noct -nomd "$file" | grep 'Min/Max' | \
-       cut -f2 -d= | tr ',' '\n' | uniq | wc -l`
+       cut -f2 -d= | head -n 3 | tr ',' '\n' | uniq | wc -l`
     if [ "$COUNT" -eq 1 ] ; then
        rm -f "$file"
        i=`expr $i + 1`



More information about the grass-commit mailing list