GDAL and OGR - anthonyblackham/GIS-Wiki GitHub Wiki

GDAL/OGR are libraries for converting GIS data among other things. Historically GDAL was used for raster formats and OGR for vector formats.

Installation

To install on Ubuntu add the repository:

sudo add-apt-repository ppa:ubuntugis/ppa && sudo apt-get update

Install

sudo apt-get install gdal-bin

Check if its installed with ogrinfo and it will yield something like this:

Usage: ogrinfo [--help-general] [-ro] [-q] [-where restricted_where|@filename]
               [-spat xmin ymin xmax ymax] [-geomfield field] [-fid fid]
               [-sql statement|@filename] [-dialect sql_dialect] [-al] [-so] [-fields={YES/NO}]
               [-geom={YES/NO/SUMMARY}] [-formats] [[-oo NAME=VALUE] ...]
               [-nomd] [-listmdd] [-mdd domain|`all`]*
               [-nocount] [-noextent]
               datasource_name [layer [layer ...]]

FAILURE: No datasource specified.

Test KMZ/KMLS https://storage.googleapis.com/google-code-archive-source/v2/code.google.com/kml-samples/source-archive.zip

Test KMLS/KMZS:

ogrinfo time-stamp-point.kmz -al -so

for the kmz if you dont have libkml (not that this is useful or anything):

ogrinfo /vsizip/time-stamp-point.kmz -al -so --config ogr_skip libkml

Convert KMZ to MBTILES

Kmz to GeoJSON

ogr2ogr -f GeoJSON yourgeojson.json yourkmz.kmz

Installing Tippecanoe

Dependencies:

sudo apt-get install build-essential libsqlite3-dev zlib1g-dev

Install

git clone https://github.com/mapbox/tippecanoe.git
cd tippecanoe
make
sudo make install

Create Mbtiles: For one layer

tippecanoe yourgeojson.geojson -o yourtiles.mbtiles

for multiple layers

tippecanoe -L layer1:layer1.geojson -L layer2:layer2.geojson -o yourtiles.mbtiles