فهرست منبع

replace python script d.vect.thematic by C module d.thematic.area

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@64002 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 سال پیش
والد
کامیت
d9753ccfff

+ 1 - 1
display/Makefile

@@ -32,7 +32,7 @@ SUBDIRS = \
 	d.title \
 	d.vect \
 	d.vect.chart \
-	d.thematic.area \
+	d.vect.thematic \
 	d.where
 
 include $(MODULE_TOPDIR)/include/Make/Dir.make

+ 0 - 56
display/d.thematic.area/d.thematic.area.html

@@ -1,56 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>d.thematic.area</em> draws thematic choropleth vector maps based 
-on an attribute column or an expression involving several columns. 
-It takes a list of class breaks (excluding the minimum and maximum 
-values) and a list of colors to apply to the classes (has to be the 
-number of class breaks + 1).
-<p>
-Instead of a list of class breaks, the user can also chose a 
-classification algorithm and a number of classes. See the 
-<em>v.class </em> man page for more information on these different 
-algorithms.
-
-The <em>-l</em> flag instructs the module to print legend 
-information (<i>class min | class max | number of observations in class 
-| color</i>) to standard output for futher use in graphical software. 
-When combined with the <em>-e</em> flag, the legend information will 
-be extended with some additional statistical information. If the
-<em>-n</em> flag is set, the module will only print the legend 
-information without drawing the map. If the user gives a
-<em>legendfile</em>, the module will write <em>d.graph</em> instructions
-for painting a legend into that file.
-
-
-<h2>EXAMPLE</h2>
-
-<div class="code"><pre>
-d.thematic.area -l map=communes3 column=pop \
-  breaks=111393.250000,222785.500000,334177.750000 \
-  colors=255:0:0,0:255:0,0:0:255,0,0,0
-</pre></div>
-
-The following example uses a calculated attribute (density = 
-pop/area) and the standard deviation algorithm to calculate class 
-breaks for 5 classes:
-
-<div class="code"><pre>
-d.thematic.area -l map=communes2 column=pop/area algorithm=std \
-  nbclasses=5 colors=0:0:255,50:100:255,255:100:50,255:0:0,156:0:0
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="v.class.html">v.class</a>,
-<a href="d.vect.html">d.vect</a>,
-<a href="d.graph.html">d.graph</a>,
-<a href="v.univar.html">v.univar</a>
-</em>
-
-
-<h2>AUTHOR</h2>
-
-Moritz Lennert
-
-<p><i>Last changed: $Date$</i>

+ 1 - 1
display/d.thematic.area/Makefile

@@ -1,7 +1,7 @@
 
 MODULE_TOPDIR = ../..
 
-PGM = d.thematic.area
+PGM = d.vect.thematic
 
 LIBES = $(ARRAYSTATSLIB) $(DISPLAYLIB) $(VECTORLIB) $(DBMILIB) $(GISLIB)
 DEPENDENCIES = $(ARRAYSTATSDEP) $(DISPLAYDEP) $(VECTORDEP) $(DBMIDEP) $(GISDEP)

display/d.thematic.area/area.c → display/d.vect.thematic/area.c


+ 72 - 0
display/d.vect.thematic/d.vect.thematic.html

@@ -0,0 +1,72 @@
+<h2>DESCRIPTION</h2>
+
+<em>d.vect.thematic</em> draws thematic choropleth vector maps based 
+on an attribute column or an expression involving several columns. 
+It takes a list of class <b>breaks</b> (excluding the minimum and maximum 
+values) and a list of <b>colors</b> to apply to the classes (has to be the 
+number of class breaks + 1).
+<p>
+Instead of a list of class breaks, the user can also chose a
+classification <b>algorithm</b> and a number of classes
+(<b>nbclasses</b>). See the
+<em><a href="v.class.html">v.class</a></em> for more information on
+these different algorithms.
+
+<p>
+<b>Important note:</b> The module currently supports only <i>area</i>
+vector type. For displaying thematic choropleth vector maps of other
+types (points, lines) can be
+used <em><a href="http://grass.osgeo.org/grass70/manuals/addons/d.vect.thematic2.html">d.vect.thematic2</a></em>
+available in AddOns
+via <em><a href="g.extension.html">g.extension</a></em>.
+
+<h2>NOTES</h2>
+
+The <b>-l</b> flag instructs the module to print legend information
+(<i>class min | class max | number of observations in class |
+color</i>) to standard output for futher use in graphical software.
+When combined with the <b>-e</b> flag, the legend information will
+be extended with some additional statistical information. If the
+<b>-n</b> flag is set, the module will only print the legend 
+information without drawing the map. If the user gives a
+<b>legendfile</b>, the module will
+write <em><a href="d.graph.html">d.graph</a></em> instructions for
+painting a legend into that file.
+
+
+<h2>EXAMPLE</h2>
+
+<div class="code"><pre>
+d.vect.thematic -l map=communes3 column=pop \
+  breaks=111393.250000,222785.500000,334177.750000 \
+  colors=255:0:0,0:255:0,0:0:255,0,0,0
+</pre></div>
+
+The following example uses a calculated attribute (<tt>density = 
+pop/area</tt>) and the standard deviation algorithm to calculate class 
+breaks for 5 classes:
+
+<div class="code"><pre>
+d.vect.thematic -l map=communes2 column=pop/area algorithm=std \
+  nbclasses=5 colors=0:0:255,50:100:255,255:100:50,255:0:0,156:0:0
+</pre></div>
+
+<h2>SEE ALSO</h2>
+
+<em>
+<a href="v.class.html">v.class</a>,
+<a href="d.vect.html">d.vect</a>,
+<a href="d.graph.html">d.graph</a>,
+<a href="v.univar.html">v.univar</a>
+</em>
+
+<p>
+Check also Python module from
+AddOns: <em><a href="http://grass.osgeo.org/grass70/manuals/addons/d.vect.thematic2.html">d.vect.thematic2</a></em>
+
+<h2>AUTHOR</h2>
+
+Moritz Lennert
+
+<p>
+<i>Last changed: $Date$</i>

display/d.thematic.area/local_proto.h → display/d.vect.thematic/local_proto.h


+ 22 - 14
display/d.thematic.area/main.c

@@ -1,11 +1,12 @@
 /*
  ****************************************************************************
  *
- * MODULE:       d.area.thematic
+ * MODULE:       d.vect.thematic
  * AUTHOR(S):    Moritz Lennert, based on d.vect
- * PURPOSE:      display a thematic vector area map
- *               on top of the current image.
- * COPYRIGHT:    (C) 2007 by the GRASS Development Team
+ * PURPOSE:      Display a thematic vector map
+ * TODO:         Common part of code merge with d.vect (similarly as r.colors
+ *               and r3.colors)
+ * COPYRIGHT:    (C) 2007-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -78,11 +79,16 @@ int main(int argc, char **argv)
     G_add_keyword(_("cartography"));
     G_add_keyword(_("choropleth map"));
     module->description =
-	_("Displays a thematic vector area map in the active "
-	  "frame on the graphics monitor.");
+	_("Displays a thematic vector map "
+	  "in the active graphics frame.");
 
     map_opt = G_define_standard_option(G_OPT_V_MAP);
 
+    field_opt = G_define_standard_option(G_OPT_V_FIELD);
+    field_opt->description =
+	_("Layer number. If -1, all layers are displayed.");
+    field_opt->guisection = _("Selection");
+
     column_opt = G_define_standard_option(G_OPT_DB_COLUMN);
     column_opt->required = YES;
     column_opt->description =
@@ -94,7 +100,8 @@ int main(int argc, char **argv)
     breaks_opt->required = NO;
     breaks_opt->multiple = YES;
     breaks_opt->description = _("Class breaks, without minimum and maximum");
-
+    breaks_opt->guisection = _("Classes");
+    
     algo_opt = G_define_option();
     algo_opt->key = "algorithm";
     algo_opt->type = TYPE_STRING;
@@ -111,13 +118,15 @@ int main(int argc, char **argv)
 	        _("equiprobable (normal distribution)"));
     algo_opt->descriptions = desc;
     /*currently disabled because of bugs       "dis;discontinuities"); */
+    algo_opt->guisection = _("Classes");
 
     nbclass_opt = G_define_option();
-    nbclass_opt->key = "nbclasses";
+    nbclass_opt->key = "nclasses";
     nbclass_opt->type = TYPE_INTEGER;
     nbclass_opt->required = NO;
     nbclass_opt->multiple = NO;
     nbclass_opt->description = _("Number of classes to define");
+    nbclass_opt->guisection = _("Classes");
 
     colors_opt = G_define_option();
     colors_opt->key = "colors";
@@ -127,11 +136,6 @@ int main(int argc, char **argv)
     colors_opt->description = _("Colors (one per class)");
     colors_opt->gisprompt = "old_color,color,color";
 
-    field_opt = G_define_standard_option(G_OPT_V_FIELD);
-    field_opt->description =
-	_("Layer number. If -1, all layers are displayed.");
-    field_opt->guisection = _("Selection");
-
     where_opt = G_define_standard_option(G_OPT_DB_WHERE);
     where_opt->guisection = _("Selection");
 
@@ -152,21 +156,25 @@ int main(int argc, char **argv)
     legend_file_opt->description =
 	_("File in which to save d.graph instructions for legend display");
     legend_file_opt->required = NO;
+    legend_file_opt->guisection = _("Legend");
 
     legend_flag = G_define_flag();
     legend_flag->key = 'l';
     legend_flag->description =
 	_("Create legend information and send to stdout");
+    legend_flag->guisection = _("Legend");
 
     algoinfo_flag = G_define_flag();
     algoinfo_flag->key = 'e';
     algoinfo_flag->description =
 	_("When printing legend info, include extended statistical info from classification algorithm");
+    algoinfo_flag->guisection = _("Legend");
 
     nodraw_flag = G_define_flag();
     nodraw_flag->key = 'n';
     nodraw_flag->description = _("Do not draw map, only output the legend");
-
+    nodraw_flag->guisection = _("Legend");
+    
     /* Check command line */
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);

display/d.thematic.area/plot.h → display/d.vect.thematic/plot.h


display/d.thematic.area/plot1.c → display/d.vect.thematic/plot1.c


+ 1 - 1
gui/wxpython/core/utils.py

@@ -1006,7 +1006,7 @@ command2ltype = {'d.rast'         : 'raster',
                  'd.rast.num'     : 'rastnum',
                  'd.rast.leg'     : 'maplegend',
                  'd.vect'         : 'vector',
-                 'd.thematic.area': 'thememap',
+                 'd.vect.thematic': 'thememap',
                  'd.vect.chart'   : 'themechart',
                  'd.grid'         : 'grid',
                  'd.geodesic'     : 'geodesic',

+ 0 - 4
gui/wxpython/lmgr/layertree.py

@@ -1251,10 +1251,6 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             elif ltype == 'vector':
                 cmd += GetDisplayVectSettings()
             
-            # ltype == 'thememap':
-            # -s flag requested, otherwise only first thematic category is displayed
-            # should be fixed by C-based d.thematic.* modules
-        
         if cmd:
             GUI(parent = self, centreOnParent = False).ParseCommand(cmd,
                                                                     completed = (self.GetOptData,layer,params))

+ 75 - 8
lib/gis/renamed_options

@@ -66,18 +66,85 @@ d.vect|lcolor:label_color
 d.vect|bgcolor:label_bgcolor
 d.vect|bcolor:label_boundary_color
 d.vect|lsize:label_size
-# d.thematic.area
-d.thematic.area|bcolor:boundary_color
-d.thematic.area|bwidth:boundary_width
+# d.vect.thematic
+d.vect.thematic|bcolor:boundary_color
+d.vect.thematic|bwidth:boundary_width
+### Renamed options in GRASS 7.0
+################################
+### Global
+#########################
+fs:separator
+nv:null_value
+dt:dtime
+dp:precision
+##########################
+### Display module changes
+##########################
+# d.barscale
+d.barscale|background_color:bgcolor
+# d.correlate
+d.correlate|layers:map
+# d.erase
+d.erase|background:bgcolor
+# d.legend
+d.legend|map:rast
+# d.his
+d.his|h_map:hue
+d.his|i_map:intensity
+d.his|s_map:saturation
+# d.rast
+d.rast|catlist:values
+d.rast|vallist:values
+# d.rast.leg
+d.rast.leg|rast:raster
+# d.vect
+d.vect|wcolumn:width_column
+d.vect|wscale:width_scale
+d.vect|rot_column:rotation_column
+d.vect|attrcolumn:attribute_column
+# d.colortable
+d.colortable|cols:columns
+# d.geodesic
+d.geodesic|lcolor:line_color
+d.geodesic|tcolor:text_color
+# d.grid
+d.grid|bordercolor:border_color
+d.grid|textcolor:text_color
+# d.path
+d.path|hcolor:highlight_color
+d.path|type:arc_type
+d.path|alayer:arc_layer
+d.path|nlayer:node_layer
+d.path|afcolumn:arc_column
+d.path|abcolumn:arc_backward_column
+d.path|ncolumn:node_column
+# d.polar
+d.polar|eps:output
+# d.profile
+d.profile|input:map
+d.profile|profile:coordinates
+# d.rast.arrow
+d.rast.arrow|arrow_color:color
+d.rast.arrow|x_color:null_color
+# d.rhumbline
+d.rhumbline|coord:coordinates
+d.rhumbline|lcolor:line_color
+d.rhumbline|tcolor:text_color
+# d.vect
+d.vect|fcolor:fill_color
+d.vect|llayer:label_layer
+d.vect|lcolor:label_color
+d.vect|bgcolor:label_bgcolor
+d.vect|bcolor:label_boundary_color
+d.vect|lsize:label_size
+# d.vect.thematic
+d.vect.thematic|bcolor:boundary_color
+d.vect.thematic|bwidth:boundary_width
+d.vect.thematic|nbclasses:nclasses
 # d.vect.chart
 d.vect.chart|ctype:chart_type
 d.vect.chart|ocolor:outline_color
 d.vect.chart|sizecol:size_column
-# d.vect.thematic
-d.vect.thematic|pointcolor:point_color
-d.vect.thematic|linecolor:line_color
-d.vect.thematic|startcolor:start_color
-d.vect.thematic|endcolor:end_color
 ######################################
 ### Database management module changes
 ######################################

+ 0 - 1
scripts/Makefile

@@ -9,7 +9,6 @@ SUBDIRS = \
 	d.rast.leg \
 	d.redraw \
 	d.shade \
-	d.vect.thematic \
 	d.what.rast \
 	d.what.vect \
 	db.dropcolumn \

+ 0 - 7
scripts/d.vect.thematic/Makefile

@@ -1,7 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM=d.vect.thematic
-
-include $(MODULE_TOPDIR)/include/Make/Script.make
-
-default: script

+ 0 - 124
scripts/d.vect.thematic/d.vect.thematic.html

@@ -1,124 +0,0 @@
-<h2>DESCRIPTION</h2>
-
-<em>d.vect.thematic</em> creates thematic maps from vector features of
-all types and numeric attributes stored in the attribute table connected to a vector
-map.
-
-<p>
-Thematic maps can be displayed by either a <i>graduated color
-scheme</i> (for all vector types), as <i>graduated icon sizes</i> (for
-point and centroid types), or <i>graduated line widths</i> (for lines
-and boundaries with associated attributes), see <b>themetype</b>
-option for details. The user selects the vector <b>map</b> to be
-mapped and attribute <b>column</b> from which to derive mapping
-intervals, and (optionally) the <b>layer</b> for attribute data.
-
-<p>In thematic maps, the color or point size changes for each range of
-attribute values. Value ranges for thematic mapping can be set at
-<i>regular intervals</i>, <i>standard deviation</i> units on either side of the
-<i>mean</i>, <i>quartiles</i>, or delimited by <i>user-defined
-breakpoints</i>, see <b>themecalc</b> option.  User-defined
-breakpoints (<b>themecalc=custom_breaks</b>) can be entered
-via <b>breakpoints</b> option.
-
-<h2>NOTES</h2>
-
-<p>There is option <b>colorscheme</b> to define the color scheme
-(graduated colors) and range of point sizes (graduated points) for
-thematic maps.
-
-<p>
-Optionally, a simple text legend is printed when <b>-l</b> flag is
-given. A graphic legend can be drawn in the selected display monitor.
-
-<p>
-Thematic colors can be uploaded by <b>rgb_column</b> option
-to a specified attribute column (which is created automatically if
-doesn't exist in the table) for later display
-via <em><a href="d.vect.html">d.vect</a></em> and <b>rgb_column</b>
-option.
-
-<p>When the <b>psmap</b> option is set to 'name', two psmap instruction files are
-created (in the current directory if no path is given), one for the map
-('name.psmap') and one for the legend ('name_legend.psmap'). The map file also
-contains 'label' commands which allow to create a legend directly in the map by
-adding a 'vlegend' command. See the <em><a href="ps.map">ps.map</a></em> manual
-page for more details.
- 
-<p>
-The algorithm currently uses the <em><a href="v.univar.html">v.univar</a></em> to calculate basic
-descriptive statistics needed for thematic mapping (minimum, maximum, mean,
-standard deviation, and quartiles).
-
-<h2>EXAMPLES</h2>
-
-Earthquake points with color gradient:
-
-<div class="code"><pre>
-d.vect.thematic -l recent_earthquakes column=magnitude type=point
-</pre></div>
-
-<p>Earthquake points with different sizes:
-
-<div class="code"><pre>
-d.vect.thematic -l recent_earthquakes column=magnitude type=point \
-                themetype=graduated_points maxsize=15
-</pre></div>
-
-<center>
-<img src="d_vect_thematic_equake.png"><br>
-Example for earthquake map rendering
-(<a href="https://trac.osgeo.org/grass/browser/grass-promo/tutorials/batch_processing/earthquakes">script code</a>)
-</center>
-
-<p>North Carolina: differences between 'elevation' (10m) and 'elev_state_500m':
-
-<div class="code"><pre>
-# random sampling of elevation points:
-g.region raster=elevation -p
-v.random random npoints=200
-v.db.addtable random column="el10 double precision"
-# transfer elevations to attribute table of random points map:
-v.what.rast random rast=elevation column=el10
-v.db.select random
-
-# comparative sampling of second map, incl. differences:
-v.sample input=random column=el10 raster=elev_state_500m output=elev_sample
-v.db.select elev_sample
-
-# univariate statistics:
-v.univar -e elev_sample column=diff type=point
-
-# thematic map:
-d.mon wx0
-d.vect.thematic -l elev_sample column=diff type=point
-</pre></div>
-
-<p>
-North Carolina sample dataset example:
-
-<div class="code"><pre>
-g.region vector=nc_state
-d.vect.thematic -l precip_30ynormals column=annual type=point
-</pre></div>
-
-<h2>SEE ALSO</h2>
-
-<em>
-<a href="d.vect.html">d.vect</a>,
-<a href="d.vect.chart.html">d.vect.chart</a>,
-<a href="v.univar.html">v.univar</a>
-</em>
-
-<h2>AUTHORS</h2>
-
-Michael Barton, Arizona State University
-
-<p>
-Various updates by:<br>
-Daniel Cavelo Aros,<br>
-Martin Landa,<br>
-Jachym Cepicky.
-
-<p>
-  <i>Last changed: $Date: 2008-08-15 08:16:42 +0200 (Fri, 15 Aug 2008)$</i>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 1131
scripts/d.vect.thematic/d.vect.thematic.py


BIN
scripts/d.vect.thematic/d_vect_thematic_equake.png


+ 4 - 4
vector/v.class/v.class.html

@@ -12,7 +12,7 @@ algorithm developed by Jean-Pierre Grimmeau at the Free University of
 Brussels (ULB).
 
 It can be used to pipe class breaks into thematic mapping modules such
-as <em>d.thematic.area</em> (see example below);
+as <em>d.vect.thematic</em> (see example below);
 
 <h2>NOTES</h2>
 
@@ -71,9 +71,9 @@ v.class map=communes column=pop/area algo=std nbclasses=5
 
 
 The following example uses the output of d.class and feeds it directly
-into <em>d.thematic.area</em>:
+into <em>d.vect.thematic</em>:
 <div class="code"><pre>
-d.thematic.area -l map=communes2 data=pop/area \
+d.vect.thematic -l map=communes2 column=pop/area \
     breaks=`v.class -g map=communes2 column=pop/area algo=std nbcla=5` \
     colors=0:0:255,50:100:255,255:100:50,255:0:0,156:0:0
 </pre></div>
@@ -82,7 +82,7 @@ d.thematic.area -l map=communes2 data=pop/area \
 
 <em>
 <a href="v.univar.html">v.univar</a>,
-<a href="d.thematic.area.html">d.thematic.area</a>
+<a href="d.vect.thematic.html">d.vect.thematic</a>
 </em>