Friday 22 June 2018

How to build gdal with MBTiles drive?


I've built GDAL so many times but I'm not know how to add MBTiles Driver support.


The source used was http://download.osgeo.org/gdal/2.1.3/ . But after build I still unable to read or write mbtiles files.


[root@localhost geo]# gdalinfo  Test.mbtiles
ERROR 4: `Test.mbtiles' not recognized as a supported file format.

gdalinfo failed - unable to open 'Test.mbtiles'.



Version:



[root@localhost ~]# gdal-config --version 2.1.3



dep-libs



[root@localhost ~]# gdal-config --dep-libs -ljpeg -lpng -L/usr/lib64 -lpq -lz -lpthread -lm -lrt -ldl -lpcre -lxml2 -lz -lm -ldl



Formats




[root@localhost ~]# gdal-config --formats gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp airsar rs2 ilwis rmf leveller sgi srtmhgt idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg coasp tsx terragen blx msgn til r northwood saga xyz hf2 kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map cals safe sentinel2 mrf grib bsb gif jpeg png pcraster pcidsk rik ozi pdf postgisraster arg



gdal translate formats:


[root@localhost ~]# gdal_translate --formats
Supported Formats:
VRT -raster- (rw+v): Virtual Raster
GTiff -raster- (rw+vs): GeoTIFF
NITF -raster- (rw+vs): National Imagery Transmission Format
RPFTOC -raster- (rovs): Raster Product Format TOC format

ECRGTOC -raster- (rovs): ECRG TOC format
HFA -raster- (rw+v): Erdas Imagine Images (.img)
SAR_CEOS -raster- (rov): CEOS SAR Image
CEOS -raster- (rov): CEOS Image
JAXAPALSAR -raster- (rov): JAXA PALSAR Product Reader (Level 1.1/1.5)
GFF -raster- (rov): Ground-based SAR Applications Testbed File Format (.gff)
ELAS -raster- (rw+v): ELAS
AIG -raster- (rov): Arc/Info Binary Grid
AAIGrid -raster- (rwv): Arc/Info ASCII Grid
GRASSASCIIGrid -raster- (rov): GRASS ASCII Grid

SDTS -raster- (rov): SDTS Raster
DTED -raster- (rwv): DTED Elevation Raster
PNG -raster- (rwv): Portable Network Graphics
JPEG -raster- (rwv): JPEG JFIF
MEM -raster- (rw+): In Memory Raster
JDEM -raster- (rov): Japanese DEM (.mem)
GIF -raster- (rwv): Graphics Interchange Format (.gif)
BIGGIF -raster- (rov): Graphics Interchange Format (.gif)
ESAT -raster- (rov): Envisat Image Format
BSB -raster- (rov): Maptech BSB Nautical Charts

XPM -raster- (rwv): X11 PixMap Format
BMP -raster- (rw+v): MS Windows Device Independent Bitmap
DIMAP -raster- (rov): SPOT DIMAP
AirSAR -raster- (rov): AirSAR Polarimetric Image
RS2 -raster- (ros): RadarSat 2 XML Product
SAFE -raster- (rov): Sentinel-1 SAR SAFE Product
PCIDSK -raster,vector- (rw+v): PCIDSK Database File
PCRaster -raster- (rw+): PCRaster Raster File
ILWIS -raster- (rw+v): ILWIS Raster Map
SGI -raster- (rw+): SGI Image File Format 1.0

SRTMHGT -raster- (rwv): SRTMHGT File Format
Leveller -raster- (rw+): Leveller heightfield
Terragen -raster- (rw+): Terragen heightfield
ISIS3 -raster- (rov): USGS Astrogeology ISIS cube (Version 3)
ISIS2 -raster- (rw+v): USGS Astrogeology ISIS cube (Version 2)
PDS -raster- (rov): NASA Planetary Data System
VICAR -raster- (rov): MIPL VICAR file
TIL -raster- (rov): EarthWatch .TIL
ERS -raster- (rw+v): ERMapper .ers Labelled
L1B -raster- (rovs): NOAA Polar Orbiter Level 1b Data Set

FIT -raster- (rwv): FIT Image
GRIB -raster- (rov): GRIdded Binary (.grb)
RMF -raster- (rw+v): Raster Matrix Format
MSGN -raster- (ro): EUMETSAT Archive native (.nat)
RST -raster- (rw+v): Idrisi Raster A.1
INGR -raster- (rw+v): Intergraph Raster
GSAG -raster- (rwv): Golden Software ASCII Grid (.grd)
GSBG -raster- (rw+v): Golden Software Binary Grid (.grd)
GS7BG -raster- (rw+v): Golden Software 7 Binary Grid (.grd)
COSAR -raster- (rov): COSAR Annotated Binary Matrix (TerraSAR-X)

TSX -raster- (rov): TerraSAR-X Product
COASP -raster- (ro): DRDC COASP SAR Processor Raster
R -raster- (rwv): R Object Data Store
MAP -raster- (rov): OziExplorer .MAP
KMLSUPEROVERLAY -raster- (rwv): Kml Super Overlay
PDF -raster,vector- (w+): Geospatial PDF
CALS -raster- (rw): CALS (Type 1)
SENTINEL2 -raster- (rovs): Sentinel 2
MRF -raster- (rw+v): Meta Raster Format
PNM -raster- (rw+v): Portable Pixmap Format (netpbm)

DOQ1 -raster- (rov): USGS DOQ (Old Style)
DOQ2 -raster- (rov): USGS DOQ (New Style)
GenBin -raster- (rov): Generic Binary (.hdr Labelled)
PAux -raster- (rw+): PCI .aux Labelled
MFF -raster- (rw+v): Vexcel MFF Raster
MFF2 -raster- (rw+): Vexcel MFF2 (HKV) Raster
FujiBAS -raster- (ro): Fuji BAS Scanner Image
GSC -raster- (rov): GSC Geogrid
FAST -raster- (rov): EOSAT FAST Format
BT -raster- (rw+v): VTP .bt (Binary Terrain) 1.3 Format

LAN -raster- (rw+v): Erdas .LAN/.GIS
CPG -raster- (ro): Convair PolGASP
IDA -raster- (rw+v): Image Data and Analysis
NDF -raster- (rov): NLAPS Data Format
EIR -raster- (rov): Erdas Imagine Raw
DIPEx -raster- (rov): DIPEx
LCP -raster- (rwv): FARSITE v.4 Landscape File (.lcp)
GTX -raster- (rw+v): NOAA Vertical Datum .GTX
LOSLAS -raster- (rov): NADCON .los/.las Datum Grid Shift
NTv2 -raster- (rw+vs): NTv2 Datum Grid Shift

CTable2 -raster- (rw+v): CTable2 Datum Grid Shift
ACE2 -raster- (rov): ACE2
SNODAS -raster- (rov): Snow Data Assimilation System
KRO -raster- (rw+v): KOLOR Raw
ROI_PAC -raster- (rw+v): ROI_PAC raster
ENVI -raster- (rw+v): ENVI .hdr Labelled
EHdr -raster- (rw+v): ESRI .hdr Labelled
ISCE -raster- (rw+v): ISCE raster
ARG -raster- (rwv): Azavea Raster Grid format
RIK -raster- (rov): Swedish Grid RIK (.rik)

USGSDEM -raster- (rwv): USGS Optional ASCII DEM (and CDED)
GXF -raster- (ro): GeoSoft Grid Exchange Format
NWT_GRD -raster- (rov): Northwood Numeric Grid Format .grd/.tab
NWT_GRC -raster- (rov): Northwood Classified Grid Format .grc/.tab
ADRG -raster- (rw+vs): ARC Digitized Raster Graphics
SRP -raster- (rovs): Standard Raster Product (ASRP/USRP)
BLX -raster- (rwv): Magellan topo (.blx)
PostGISRaster -raster- (rws): PostGIS Raster driver
SAGA -raster- (rw+v): SAGA GIS Binary Grid (.sdat)
XYZ -raster- (rwv): ASCII Gridded XYZ

HF2 -raster- (rwv): HF2/HFZ heightfield raster
OZI -raster- (rov): OziExplorer Image File
CTG -raster- (rov): USGS LULC Composite Theme Grid
E00GRID -raster- (rov): Arc/Info Export E00 GRID
ZMap -raster- (rwv): ZMap Plus Grid
NGSGEOID -raster- (rov): NOAA NGS Geoid Height Grids
IRIS -raster- (rov): IRIS data (.PPI, .CAPPi etc)

Config params:


./configure  --with-threads \

--with-libtiff \
--with-ogr \
--with-geos \
--without-libtool \
--with-libz=internal \
--with-libtiff \
--with-geotiff \
--with-gif \
--with-pg \
--with-grass \

--with-libgrass \
--with-cfitsio \
--with-pcraster \
--with-netcdf \
--with-png \
--with-jpeg \
--with-odbc \
--with-curl \
--with-sqlite3 \
--with-idb \

--with-sde \
--with-perl \
--with-php \
--with-ruby \
--with-python \
--with-ogpython \
--with-hide-internal-symbols

Answer



You can try this way, it helped me.


Append repository for libspatialite5 and libgeos-c1 to source list (if it does not exist)



sudo gedit /etc/apt/sources.list

deb http://us.archive.ubuntu.com/ubuntu vivid main universe

then install dependencies


sudo apt update

libspatialite5 depend on libgeos-c1 (>= 3.4.2), so in my case it is


sudo apt install libspatialite5 libgeos-c1 libspatialite-dev  spatialite-bin sqlite3


cd to your GDAL folder


$ cd gdal-2.1.3/

make configuration


./configure --with-spatialite --with-sqlite

run


make

and then



sudo make install

Thanks user30184 and Dmitriy Litvinov. More information about this case you can find Convert .tif to .mbtiles using python/GDAL


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...