[GRASS-SVN] r60306 - grass-addons/grass6/raster/r.out.mbtiles_prep
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun May 18 00:37:04 PDT 2014
Author: hamish
Date: 2014-05-18 00:37:04 -0700 (Sun, 18 May 2014)
New Revision: 60306
Modified:
grass-addons/grass6/raster/r.out.mbtiles_prep/description.html
grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep
Log:
add dpi contral as a module option;
fix zoom level metadata for mapurl file when given manually;
removal of .aux.xml can take a while, so add a status g.message;
color map fringe white
Modified: grass-addons/grass6/raster/r.out.mbtiles_prep/description.html
===================================================================
--- grass-addons/grass6/raster/r.out.mbtiles_prep/description.html 2014-05-18 06:27:55 UTC (rev 60305)
+++ grass-addons/grass6/raster/r.out.mbtiles_prep/description.html 2014-05-18 07:37:04 UTC (rev 60306)
@@ -15,6 +15,13 @@
<tt>/sdcard/maps/</tt> on your Android device and select the mapurl file
as the tile source in <em>Geopaparazzi</em>. The MBTiles SQLite
database will then be populated in the background.
+<p>
+Too many tiles? Use the <b>zoom</b> parameter to limit the current
+operation to a single zoom level, then crop the region with
+<em>g.region</em> to where you need detailed coverage and re-run
+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.
<h2>EXAMPLE</h2>
Modified: grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep
===================================================================
--- grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep 2014-05-18 06:27:55 UTC (rev 60305)
+++ grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep 2014-05-18 07:37:04 UTC (rev 60306)
@@ -66,6 +66,13 @@
#% label: TMS zoom levels to create
#% description: Format: '0-19', or '10' (default: automatic)
#%End
+#%Option
+#% key: dpi
+#% type: integer
+#% label: DPI of the target display
+#% description: Value for a smartphone might be 225, a desktop perhaps 96.
+#% answer: 225
+#%End
#%Flag
#% key: t
#% description: Create a tarball
@@ -282,11 +289,15 @@
if [ -n "$GIS_OPT_ZOOM" ] ; then
ZOOM="$GIS_OPT_ZOOM"
- # pick a mid-level zoom for the mapurl file
if [ `echo "$ZOOM" | grep -c '\-'` -gt 0 ] ; then
- maxzoom=`echo "$ZOOM" | awk -F '-' '{print $1 + int(($2 - $1) / 2)}'`
+ # pick a mid-level zoom for the mapurl file
+ default_zoom=`echo "$ZOOM" | awk -F '-' '{print $1 + int(($2 - $1) / 2)}'`
+ maxzoom=`echo "$ZOOM" | cut -f2 -d'-'`
+ minzoom=`echo "$ZOOM" | cut -f1 -d'-'`
else
+ default_zoom="$ZOOM"
maxzoom="$ZOOM"
+ minzoom="$ZOOM"
fi
else
@@ -296,7 +307,7 @@
# adjust as needed depending if you are working on a desktop monitor or mobile device:
# a value of 96 might be appropriate for desktop, 225 for tablet or smartphone. YMMV.
- SCREEN_DPI=225
+ SCREEN_DPI="$GIS_OPT_DPI"
#SCALE_NS=$ns_extent/(($rows/$DPI)*$INCH2METER)
#SCALE_EW=$ew_extent/(($cols/$DPI)*$INCH2METER)
@@ -326,6 +337,8 @@
fi
ZOOM="$minzoom-$maxzoom"
+
+ default_zoom=`expr $maxzoom - 2`
fi
@@ -359,6 +372,8 @@
rm -f "$TMP_GMERC"
+g.message "Dropping unneeded auxiliary metadata files ..."
+
for file in `find $(dirname "$OUT_DIR") | grep .aux.xml` ; do
rm -f "$file"
done
@@ -387,7 +402,7 @@
mbtiles=$OUTFILE/$OUTFILE.mbtiles
name=$TITLE
description=Exported zoom level(s) $ZOOM from GRASS GIS r.out.mbtiles_prep
-defaultzoom=`expr $maxzoom - 2`
+defaultzoom=$default_zoom
format=$ext
request_type=run,fill,load,reset_metadata
EOF
@@ -429,7 +444,7 @@
for file in `find . | grep '.png$'` ; do
outfile=`echo "$file" | sed -e 's/\.png$/.jpg/'`
- pngtopnm "$file" | pnmtojpeg > "$outfile"
+ pngtopnm -mix -background '#FFFFFF' "$file" | pnmtojpeg > "$outfile"
if [ $? -eq 0 ] ; then
rm "$file"
fi
More information about the grass-commit
mailing list