[mapnik-vector-tile] 08/14: Create blank tif for raster_tile test

Jérémy Lal kapouer at moszumanska.debian.org
Wed Aug 20 21:26:20 UTC 2014


This is an automated email from the git hooks/post-receive script.

kapouer pushed a commit to branch master
in repository mapnik-vector-tile.

commit 21437ae1481984d09407ec0796b55e7ee526fccc
Author: Jérémy Lal <kapouer at melix.org>
Date:   Wed Aug 20 23:02:07 2014 +0200

    Create blank tif for raster_tile test
---
 debian/control          |  4 +++-
 debian/create-raster.py | 26 ++++++++++++++++++++++++++
 debian/rules            |  1 +
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 321ca87..6a76377 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,9 @@ Build-Depends:
  protobuf-compiler,
  libprotobuf-dev,
  catch,
- libmapnik-dev (>= 2.2.0~)
+ libmapnik-dev (>= 2.2.0~),
+ python,
+ python-gdal
 Standards-Version: 3.9.5
 Homepage: https://github.com/mapbox/mapnik-vector-tile
 Vcs-Git: git://anonscm.debian.org/pkg-grass/mapnik-vector-tile.git
diff --git a/debian/create-raster.py b/debian/create-raster.py
new file mode 100644
index 0000000..d419ca7
--- /dev/null
+++ b/debian/create-raster.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+try:
+    from osgeo import gdal
+except:
+    import gdal
+    
+tiff = 'test/natural_earth.tif'
+tiff_width = 1048
+tiff_height = 1048
+extent = (-20037507.161367048, 20037508.342789248, -20037508.34278927, 18428920.01277216)
+
+x_res = (extent[1] - extent[0]) / tiff_width
+y_res = (extent[3] - extent[2]) / tiff_height
+
+raster = gdal.GetDriverByName('GTiff')
+dest = raster.Create(tiff, tiff_width, tiff_height, 4, gdal.GDT_Byte, options = [ 'COMPRESS=JPEG' ])
+
+raster_transform = [extent[0], x_res, 0.0, extent[3], 0.0, -y_res]
+dest.SetGeoTransform(raster_transform)
+
+dest.GetRasterBand(1).Fill(0)
+dest.GetRasterBand(2).Fill(0)
+dest.GetRasterBand(3).Fill(0)
+dest.GetRasterBand(4).Fill(255)
+
diff --git a/debian/rules b/debian/rules
index bc7aaac..26c5662 100755
--- a/debian/rules
+++ b/debian/rules
@@ -9,4 +9,5 @@
 
 override_dh_auto_test:
 	ln -s /usr/include/catch.hpp test/
+	python debian/create-raster.py
 	dh_auto_test

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/mapnik-vector-tile.git



More information about the Pkg-grass-devel mailing list