[GRASS-dev] Thanks for r.to.vect.tiled

Nikos Alexandris nik at nikosalexandris.net
Tue Dec 15 13:57:03 PST 2015


Salut Markus :-)

Thank you for r.to.vect.tiled -- really very useful!

Below a silly quick hack to suggest for setting the region?  It just
happened that I imported a raster in a Mapset with the region not set
and I was thinking, as usual, for a while what could be wrong.

Cheers, Nikos



Index: r.to.vect.tiled.py
===================================================================
--- r.to.vect.tiled.py  (revision 65937)
+++ r.to.vect.tiled.py  (working copy)
@@ -130,13 +130,19 @@
 
     grass.use_temp_region()
     curr = grass.region()
+
     width = int(curr['cols'] / xtiles)
+    height = int(curr['rows'] / ytiles)
+
+    message_fatal = "The requested number of tiles in {XY} direction is too large."
+    message_region_hint = "Perhaps the computational region is not set properly?"
+    
     if width <= 1:
-       grass.fatal("The requested number of tiles in x direction is too large")
-    height = int(curr['rows'] / ytiles)
+       grass.fatal( message_fatal.format(XY='x') + ' ' + message_region_hint)
+    
     if height <= 1:
-       grass.fatal("The requested number of tiles in y direction is too large")
-
+       grass.fatal( message_fatal.format(XY='y') + ' ' + message_region_hint)
+    
     do_clip = False
     overlap = 0
     if flags['s'] and ftype == 'area':


More information about the grass-dev mailing list