• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
North River Geographic Systems Inc

North River Geographic Systems Inc

Geospatial Problem Solving

  • Home
  • About NRGS
  • Training
  • Blog
  • Resources
    • QGIS Tutorials and Hacks
    • GDAL Tutorials and Hacks
    • PostGIS Tutorials and Hacks
    • GRASS Tutorials and Hacks
    • OSM Tutorials and Hacks
  • Services
    • Support and Services
    • Tennessee NG911 Address Server
    • Forestry Database Services
    • Conservation GIS
  • Portfolio
  • Show Search
Hide Search

Building a Mbtile for Fulcrum

I like watching MapBox.  A few years ago, they developed an mbtile format. You can stick imagery into an sqlite database and use it in several applications – in my case I use it in Fulcrum. It seems like (at least for me) the mbtiles raster excitement turned into a vector tiles excitement and everyone just sorta moved on….except I still need to build mbtiles.

So what do I do?

Up until a few months back I was kerplunking my way through mbtiles using tilemill. I followed these instructions from fulcrum and it still works.  Except TileMill has dropped out of active development. It’s open source so maybe the community steps up and keeps it going and maybe not. It’s the cool thing about Open Source software – if the company stops supporting it (mapbox) it still stands a chance. Linux is my main desktop and it stopped being install-able for me a few months back. On windows it was still working. So I feel like I need to find another way to make this happen.

What does the client need? For right now they just need the orthoimagery they have loaded into fulcrum. They are developing a process to go collect utility assets in the field. After some debate it came down to “we just want the imagery”. As time goes on they are going to start developing more capability/flexibility as they move more or their core GIS Functions to ArcGIS/QGIS/PostGIS/Fulcrum/Geoserver.

After doing some digging I’m down to two solutions: QMetaTiles and GDAL.

QMetaTiles is a plugin for QGIS. I’ve run it under QGIS 2.14 and 2.16. It works….mostly. I was able to crash QGIS building an mbtile plus build an mbtile when it didn’t crash. It happens. That’s inspired me to play around with it a bit more and maybe start trying to file some bug reports.

Selection_338

Overall it works but it doesn’t “turn me on” – it builds a mbtile out of what you have displayed in the canvas….but the crashing thing….

With the newest version of QGIS out – 2.16 you also get GDAL 2.10. I can’t say enough good things about GDAL currently. It’s my swiss army fix-it tool for a lot of things.  They have a lot of .5 foot pixel imagery in their area of interest. About 25GB worth if you really want to know. It’s all tiled up into about 60 something images.

With gdal 2.10 here is what I did from the good old command line side of life:

gdalbuildvrt client.vrt *.tif – So what does that do? Builds a virtual image catalog on disk. I can build one vrt file and get all my imagery in one click. It’s comparable to an ESRI image catalog.

gdal_translate client.vrt client.mbtiles -of MBTILES -co TILE_FORMAT=JPEG -tr 1 -1 – so what does that do? Takes my vrt and converts it into an mbtile. GDAL by default goes to png but I want jpeg for compression. I also convert the .5 pixel images to 1 pixel for file size. Out of that I’m getting a 400 mb mbtile. If I let it default to png and .5 foot pixels I’m close to a 6 GB mbtile. I built one – it made me sweat.

gdaladdo -r average client.mbtile 2 4 8 16 – So what does that do? Builds pyramid layers.

The great thing with TileMill and QMetaTiles is if you want vector data you just add it in and it’s incorporated into your mbtile. The client doesn’t for now – so I’m not going to worry about it so much – but I’m going to experiment with the GDAL option some more. My guess is I can convert my vector to raster and incorporate that into what I’ve done so far.

I uploaded one test record into Fulcrum and I’m good to go for data collection.

Screenshot_20160717-193855

So if you need an mbtile and you have qgis 2.16 or GDAL 2.10 – you’re only three commands away from building an mbtile.

 

 

Primary Sidebar

Calendar

July 2022
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031
« Jun    

What we talk about

addresses ArcGIS ASPRS Athens Atlanta Beer Cartography Chattanooga Community Conference Data Do Some Good Education ESRI Forestry FOSS4G foss4gna Fulcrum gaurisa ga urisa Gdal Georgia GeoServer GIS GISP Google GRASS Lidar MAGS open source OpenStreetMap osgeo OSM postgis Python QGIS raleigh Rambling Small Business Tennessee TNGIC Topology Training URISA usvi

North River Geographic Systems Inc

  • Home
  • About NRGS
  • Training
  • Blog
  • Resources
  • Services
  • Portfolio