From 2f7108dd6870c1e4237ec8d922affabeb6e7eeb1 Mon Sep 17 00:00:00 2001 From: Kevin Wurster Date: Wed, 11 Mar 2015 01:57:26 -0400 Subject: [PATCH] Small change and removal of pypy from Travis --- .travis.yml | 1 - gj2ascii.py | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 98b5403..3c047cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ python: - "2.7" - "3.3" - "3.4" - - pypy before_install: - sudo add-apt-repository -y ppa:ubuntugis/ppa diff --git a/gj2ascii.py b/gj2ascii.py index 2557bd9..d72ff86 100644 --- a/gj2ascii.py +++ b/gj2ascii.py @@ -155,10 +155,13 @@ def main(infile, outfile, width, layer_name, render_all, fill, value, all_touche x_min, y_min, x_max, y_max = _geom.bounds # Compute output height and cell size + # Some line and point datasources could yield a situation where the height is 0. Check and adjust. x_delta = x_max - x_min y_delta = y_max - y_min cell_size = x_delta / width - height = int(y_delta / cell_size) + 1 + height = int(y_delta / cell_size) + if height is 0: + height += 1 transform = affine.Affine.from_gdal(*(x_min, cell_size, 0.0, y_max, 0.0, -cell_size)) # If rending all then the geometries are already wrapped in a generator