[GRASS-SVN] r60358 - grass-addons/grass6/raster/r.out.mbtiles_prep

svn_grass at osgeo.org svn_grass at osgeo.org
Mon May 19 20:11:33 PDT 2014


Author: hamish
Date: 2014-05-19 20:11:33 -0700 (Mon, 19 May 2014)
New Revision: 60358

Modified:
   grass-addons/grass6/raster/r.out.mbtiles_prep/description.html
   grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep
Log:
improve efficiency of sql command file generation loop

Modified: grass-addons/grass6/raster/r.out.mbtiles_prep/description.html
===================================================================
--- grass-addons/grass6/raster/r.out.mbtiles_prep/description.html	2014-05-20 03:06:44 UTC (rev 60357)
+++ grass-addons/grass6/raster/r.out.mbtiles_prep/description.html	2014-05-20 03:11:33 UTC (rev 60358)
@@ -11,7 +11,11 @@
 <p>
 If not specified the zoom level will be automatically chosen.
 <p>
-When finished, copy the <b>output</b> directory and mapurl file to
+The MBTiles output file has not been deduplicated to only store unique
+images in the database. Currently this can be accomplished by copying
+the tile tree onto an Android device and letting <em>Geopaparazzi</em>
+create the .mbtiles file.
+To do this, copy the <b>output</b> directory and mapurl file to
 <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.
@@ -87,7 +91,8 @@
 
 <h2>TODO</h2>
 
-Ability to create the MBTiles SQLite database directly.
+Ability to create the MBTiles SQLite database with a deduplication
+process to store only unique tile images.
 <p>
 On MS Windows <tt>gdal2tiles.py</tt> is called <tt>gdal2tiles.bat</tt>.
 Some minor adjust is needed in the script to select the correct name.

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-20 03:06:44 UTC (rev 60357)
+++ grass-addons/grass6/raster/r.out.mbtiles_prep/r.out.mbtiles_prep	2014-05-20 03:11:33 UTC (rev 60358)
@@ -509,12 +509,9 @@
    # see https://github.com/geopaparazzi/geopaparazzi/wiki/mbtiles-Implementation
    (
    for file in `find "$OUTFILE" -name "*.$ext"` ; do
-      crop=`echo "$file" | sed -e "s|.*$OUTFILE/||" -e "s|\.$ext||"`
-      zoomlevel=`echo "$crop" | cut -f1 -d'/'`
-      column=`echo "$crop" | cut -f2 -d'/'`
-      row=`echo "$crop" | cut -f3 -d'/'`
+      zoomcolrow=`echo "$file" | sed -e "s|.*$OUTFILE/||" -e "s|\.$ext||" -e 's|/|, |g'`
 
-      echo "INSERT INTO tiles VALUES ($zoomlevel, $column, $row, X'`hexdump -v -e '1/1 "%.2x"' $file`');"
+      echo "INSERT INTO tiles VALUES ($zoomcolrow, X'`hexdump -v -e '1/1 "%.2x"' $file`');"
    done
    ) > "${TMPFILE}_tiles.sql"
 



More information about the grass-commit mailing list