[GRASS-SVN] r63902 - grass/trunk/scripts/d.vect.thematic
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 1 09:31:40 PST 2015
Author: martinl
Date: 2015-01-01 09:31:40 -0800 (Thu, 01 Jan 2015)
New Revision: 63902
Modified:
grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py
Log:
d.vect.thematic: fix calculating range min/max
Modified: grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py
===================================================================
--- grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py 2015-01-01 14:14:28 UTC (rev 63901)
+++ grass/trunk/scripts/d.vect.thematic/d.vect.thematic.py 2015-01-01 17:31:40 UTC (rev 63902)
@@ -33,7 +33,7 @@
#% required: yes
#%end
#%option G_OPT_V_TYPE
-#% answer: area
+#%answer: point,line,area
#%end
#%option G_OPT_DB_WHERE
#% guisection: Theme
@@ -338,6 +338,7 @@
else:
stype = ["point", "centroid"]
+ grass.message(_("Calculating statistics..."))
stats = grass.read_command('v.univar', flags = 'eg', map = map, type = stype, column = column, where = where, layer = layer)
if not stats:
grass.fatal(_("Unable to calculate statistics for vector map <%s>" % map))
@@ -441,7 +442,7 @@
# open file for psmap instructions
f_psmap = file(tmp_psmap, 'w')
-
+
# graduated color thematic mapping
if themetype == "graduated_colors":
if colorscheme in colorschemes:
@@ -546,7 +547,7 @@
ref bottom left
end
""")
-
+
grass.message("")
grass.message(_("Color(R:G:B)\tValue"))
grass.message("============\t==========")
@@ -557,7 +558,6 @@
i = 0
first = True
-
while i < numint:
if flag_m:
# math notation
@@ -568,7 +568,7 @@
first = False
else:
closebracket = "]"
- openbracket = "]"
+ openbracket = "["
mincomparison = ">"
else:
closebracket = ""
@@ -578,7 +578,7 @@
first = False
else:
mincomparison = ">"
-
+
themecolor = ":".join(__builtins__.map(str,color))
if flag_f:
linecolor = "none"
@@ -588,9 +588,12 @@
else:
linecolor = linecolor
- rangemin = __builtins__.min(breakpoints)
- rangemax = __builtins__.max(breakpoints)
-
+ ### ???
+ ### rangemin = __builtins__.min(breakpoints)
+ ### rangemax = __builtins__.max(breakpoints)
+ rangemin = breakpoints[i]
+ rangemax = breakpoints[i+1]
+
if not annotations:
extranote = ""
else:
@@ -784,7 +787,7 @@
if i == numint:
color = endcolor
else:
- color = [a - b for a, b in zip(color, clrstep)]
+ color = [__builtins__.min(a - b, 255) for a, b in zip(color, clrstep)]
line1 -= 4
line2 -= 4
line3 -= 4
@@ -918,8 +921,11 @@
if flag_f:
linecolor = "none"
- rangemin = __builtins__.min(breakpoints)
- rangemax = __builtins__.max(breakpoints)
+ ### ???
+ ### rangemin = __builtins__.min(breakpoints)
+ ### rangemax = __builtins__.max(breakpoints)
+ rangemin = breakpoints[i-1]
+ rangemax = breakpoints[i]
if not annotations:
extranote = ""
More information about the grass-commit
mailing list