TileCutter – A small utility to generate tile cache in the MBTiles format from ArcGIS Dynamic Map Services
Thought I would share a little utility I had written up to generate tile caches in the MBTiles format for ArcGIS Dynamic Map Services. The MBTiles cache format is very simple and makes moving caches between machines very easy since you just have to transfer one file instead of the thousands of files that need to be copied for normal tile caches. The TileCutter is a console utility and accepts the scale range and the extent in latitude/longitude for which the cache should be generated. It also takes a few other options listed below.
Options: -h, --help Show this message and exits -m, --mapservice=VALUE Url of the ArcGIS Dynamic Map Service to be cached -o, --output=VALUE Location on disk where the tile cache will be stored -z, --minz=VALUE Minimum zoom scale at which to begin caching -Z, --maxz=VALUE Maximum zoom scale at which to end caching -x, --minx=VALUE Minimum X coordinate value of the extent to cache -y, --miny=VALUE Minimum Y coordinate value of the extent to cache -X, --maxx=VALUE Maximum X coordinate value of the extent to cache -Y, --maxy=VALUE Maximum Y coordinate value of the extent to cache -p, --parallelops=VALUE Limits the number of concurrent operations run by TileCutter -r, --replace=VALUE Delete existing tile cache MBTiles database if already present and create a new one.
To just try it out, just run TileCutter.exe, it will download tiles for some default extents from an ESRI sample server
TileCutter -z=7 -Z=10 -x=-95.844727 -y=35.978006 -X=-88.989258 -Y=40.563895 -o=”C:\LocalCache” -m=”http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer”
The TileCutter does request tiles in parallel threads and allows to you controls the number of concurrent operations. I don’t want to write too much about it yet since i am still working to add more capabilities to it. I am planning on providing the ability to generate MBTile caches for WMS services, OSM tiles etc in the future and more if there is interest. Also, planning on implementing a way to avoid storing duplicate tiles(for example, empty tiles in the ocean etc). I just wanted to get the tool out there early to get feedback and guage interest. So, if you have queries/interest/feature requests, let me know🙂
Also, I will blog about a little piece of code for a IHttpHandler that will serve up the MBTiles to web clients pretty soon. Stay tuned…