wiki:GSoC/2016/BasicCartographySuiteInGRASS

Version 38 (modified by wenzeslaus, 7 years ago) ( diff )

query simply gets anything which is not bad as long as it is clearly stated

Complete basic cartography suite in GRASS GIS wxGUI Map Display

Title: Complete basic cartography suite in GRASS GIS wxGUI Map Display
Student Name: Adam Laza, Czech Technical University in Prague
Organization: OSGeo - Open Source Geospatial Foundation
Mentor Name: Anna Petrasova, Vaclav Petras
GSoC proposal: https://summerofcode.withgoogle.com/projects/#6052618879107072 view proposal]
Link to code: https://github.com/lazaa32/SoC16

Brief description

Currently a GRASS GIS user is forced to use Cartographic Composer or use another software (e.g. QGIS) to create hard copy map outputs with all features. The aim of this project is to develop complete basic cartography suite for the wxGUI Map Display so it could serve for most of the science publications. The goal is not to substitute QGIS Cart Comp or similar, it's just about completing all features so the cartography scripting abilities of GRASS GIS and its potential can be fully used.

State before GSoC

GRASS GIS contains some modules which would be good to implement into cartography suite for wxGUI Map Display. There are d.barscale, d.graph, d.histogram, d.legend and many other d.* commands to use. There are bugs in some of them and it needs to be fixed (options for map window size). Then there are some modules which need to be enhanced. Legend background is currently transparent ­> add an options for opacity, border and corner settings. It's possible to set number of breaks/ticks for legend but values are not rounded ­> add an option for manual brakes/ticks, add an option for automatic breaks/ticks (every ten, hundred).

Addition to the project

GRASS GIS is an important OSGeo project but it is perceived as not suitable for cartography which prevents a lot of users from utilizing as a GIS. Completing basic cartography suite in GRASS GIS should satisfy needs of significant part of potential user community. Moreover, GRASS GIS provides an easy way to automate simple map creation using scripting. However, only with complete suite of basic functions implemented in this GSoC project, the cartography scripting abilities of GRASS GIS can be fully used.

Project plan

The idea of the project is to start with easy­to­implement stuff and step­by­step implement the more difficult ones. There are many details which need to be improved and many others which are missing entirely so the users have to use another software (legend background, north arrow orientation)

Project plan
Date Goals status
MAY 23 Starting GSoC *
MAY 23 -­ 27 Store legend, scale bar, north arrow and text in workspace, bug fixing (e.g. workspace loading) (wxGUI). *
MAY 30 ­- JUNE 3 Add units to legend (optionally also title) as parameter. Option for switch legend to linear/logarithmic scale. Manual/automatic breaks/ticks for legend (option for rounded values, option for every ten,hundred). *
JUNE 6 ­- 10 Legend background (border, rounded corners, opacity settings) (d.legend, C).Support map units in scale bar (not only meters).Allow user to set the length of scale bar (in map units) (d.barscale). *
JUNE 13 ­- 17 Possibility to add any image (as in animation tool). Use cases: logo/watermark, workaround for overview maps.
JUNE 20 ­- 24 General shapes.
JUNE 20 ­- 27 Midterm evaluations *
JUNE 27 ­- 1 JULY General shapes.
JULY 4 ­- 8 Implement vector legend. Enhance d.vect.thematic. *
JULY 11 ­- 15 Implement vector legend. Enhance d.vect.thematic. *
JULY 18 ­- 22 Implement vector legend. Enhance d.vect.thematic. *
JULY 25 ­- 29 Implement vector legend. Enhance d.vect.thematic. Testing, writing documentation. *
AUGUST 1 -­ 5 Testing, writing documentation. *
AUGUST 8 ­- 12 One week buffer in case of delay. *
AUGUST 15 ­- 23 Submitting code and evaluations. *
AUGUST 23 ­- 29 Final Evaluations
AUGUST 30 Ending GSoC

Tickets

We are using keywords cartography and gsoc2016 to mark the tickets which are tasks for this GSoC.

Solved (during GSoC or later):

#1242
vector fills and line widths not displaying in latlon regions
#2369
Include map elements into GRASS workspaces
#2494
d.vect.thematic broken
#2714
wish: logarithmic legend for raster maps
#3013
support background and border for d.legend
#3014
Add ticks to continuous raster legend
#3015
Add legend title
#3016
Add option to set scalebar length
#3017
support for background option for grid labels in d.grid
#3018
Specify custom label for d.northarrow
#3019
Add other existing symbols to d.northarrow
#3025
support for color and background color in "Add text layer" from wx monitors
#3031
Rotate symbol for north arrow in d.northarrow
#3044
d.northarrow: transparent color does not work
#3098
problems with legend with categorical data and smooth gradient option
#3106
Transparent legend background does not work with categorical legend
#3122
d.legend.vect: possibility to change text of displayed labels and select labels to show/not show
#3123
d.legend.vect: wrong handling of spaces in legend_label
#3020
Make N with arrow optional in d.barscale styles
#3081
Add text after labels in d.legend

Still active:

#3024
Add any image from a file to a map display
#2582
please restore important thematic map features themetype, themecalc etc.
#2838
d.labels placement issue
#3053
d.grid: -n flag also disables text drawing
#3076
r.colors: parameter for scaling of values
#3077
r.colors: flag to output color table type and value range
#3099
d.barscale: add support for LatLong locations
#3109
d.grid: more enhancements
#3124
d.northarrow incosistent placement when rendering to file/screen
#3125
d.legend.vect: take into account size_column/width_column in legend
#3050
Set size in d.northarrow
#3082
Multiply the label values in d.legend (0-1 to 0-100)
#3029
Add ps.map north arrows to d.northarrow
#3051
Allow image to be saved in Map Display even when there is no map

Vector legend

Draft of legend implementation. Please edit or change completely.

  • d.legend.vect in C
  • input csv file: vector symbol color fill_color size width label
    • symbols for lines and areas must be created
    • if mixed feature types, either special symbols or separate entries or just use symbol (needs to be decided)
  • d.vect - add new parameters for specifying legend, d.vect would have a flag to write a file with this specification
    • for example new parameter legend_label
  • GUI takes files generated by d.vect commands, and puts them together and calls d.legend.vect to render the legend
  • the same could be done for d.vect thematic
  • users can also customize the input text file - a special widget needs to be developed to simplify it.
  • d.legend.vect should have vector parameter - only those will be rendered

G7:d.graph code:

color red
polygon
10 10
10 20
20 20
20 10
color black
move 22 10
size 24 24
text Red area

See for example: source:grass-addons/tools/std_dataset_display.py and the resulting image.

Development

Weekly reports

Bounding period

Bounding period, April, 22 - May, 22

I got in touch with my mentors. We discussed some possibilities for development. I installed Ubuntu, GRASS and QtCreator on my laptop. I got little bit stucked with QtCreator Debugger, but with my mentors help it works now. I looked at the bug #2494 and did a little research on it. I fixed the bug #2463. X-axis ticks labels now work in d.histogram.

Week 1

Week 1, May, 23-27

  1. What did you get done this week?

I worked on the module d.northarrow. I solved the ticket #3018 and added option for custom north-arrow label. I solved the ticket #3019 and added more north-arrow symbols. I solved the ticket #3031 and added option for north-arrow symbol rotation. I fixed the bug #1242 module now works in Lat-Long projection too but I need discuss the solution with my mentors.

d.mon cairo=northarrow.png
d.rast map=srtm
d.northarrow style=star rotation=15 label=NORTH color=red fill_color=yellow at=90,15

I worked on the module d.barscale. I solved the ticket #3016, added option length for custom barscale size, option segment for setting number of segments of barscale, added flag -u to display full unit name/only symbol. I need discuss the solution with my mentors. I solved the ticket #3020 and added flag for displaying a capital N with a simple arrow over it next to the barscale.

d.mon cairo=barscale.png
d.rast map=srtm
d.barscale style=part_checker length=500000 segment=8 color=blue text_position=over -unf

I worked on the module d.grid. I solved the ticket #3017 and added option to choose background color of grid labels.

d.mon cairo=barscale.png
d.rast map=srtm
d.grid size=50000 text_color=green bg_color=gray

  1. What do you plan on doing next week?

Next week I want to continue with others d.* modules and look on d.text and d.vect modules.

  1. Are you blocked on anything?

I don't think I am blocked on anything but I work in slow pace because all d.* modules are written in C which I have few experience with.

Week 2

Week 2, May, 30 - June, 3

  1. What did you get done this week?

I worked on the module d.grid. I work on the ticket #3017 and fixed some bugs.

d.mon cairo
d.rast map=srtm
d.grid size=0:30 -g text_color=black bg_color=cyan

I worked on the module d.barscale. I solved the ticket #3016 and added option for barscaLe units.

d.mon cairo
d.rast map=srtm
d.barscale units=miles label=miles length=100

I worked on the module d.legend. I started to solve tickets related with d.legend. I've already added option for legend title, now I work on legend labels and ticks.

d.mon cairo
d.rast map=srtm
d.legend title=Title

I worked on GUI/Workspace I started to solve ticket #2369 and to integrate map elements size and position into workspace. I made a draft of XML structure that should be saved into workspace .gxw file. I started to extend class WriteWorkspaceFile() so map elements will be saved into workspace file too.

  1. What do you plan on doing next week?

I will work further on the module d.legend. I will add more options for labels and values. I will add options for background and border. I will work on workspace. I want to finish class for writing into workspace file and start working on reading class.

  1. Are you blocked on anything?

Not really. This week I spent more time at the university than I had expected but I will work during week-end so it should be OK.

Week 3

Week 3, June, 6 - 10

  1. What did you get done this week?

I worked on the module d.legend. I worked on ticket #3014. I added ticks for labels generated from labelnum option. I added option tick_value, so user can specify custom values to display ticks and labels.

d.mon cairo
d.rast map=srtm
d.legend raster=srtm title="MY TITLE" labelnum=5 tick_value=1500,3000,4000

I worked on GUI/Workspace #2369 Map elements like barscale, north arrow and legend now can be saved to/restore from workspace file. I fixed the bug which caused that user got a save-changes alert even though hadn't change anything.

  1. What do you plan on doing next week?

I will add some more features to d.legend. I'd like to add background and border options. I will work on workspace. After discussion with my mentor I should implement option for adding text with d.text value.

  1. Are you blocked on anything?

Nope.

Week 4

Week 4, June, 13 - 18

  1. What did you get done this week?

I worked on the module d.legend. I worked on ticket #3013. I added background and border options and option for title fontsize. I worked on ticket #2714. I added logarithmic legend for raster maps.

I worked on GUI/Workspace #2369 I rewrote the code so now d.text module is used instead of wxPython text.

  1. What do you plan on doing next week?

There's still a lot of work on GUI/Workspace with d.text. I need to take few days off because I won't have access to my computer. I suppose I will work more during weekend.

  1. Are you blocked on anything?

Nope.

Week 5

Week 5, June, 20 - 24

  1. What did you get done this week?

This week I was three days off so I didn't much. Next week I'm coming back home from my exchange program and then I will have more time to work. I worked on legend background border and fill.

g.region raster=elevation -p
d.rast elevation
d.legend raster=elevation -t label_step=20 label_values=108 title=Legend -b bgcolor=255:255:204 border_color=gray

I worked on logarithmic scale of d.legend module. It works now.

g.region raster=elevation -p
r.watershed -a elevation=elevation threshold=1000 accumulation=flowacc
d.rast flowacc
d.legend raster=flowacc -t -l label_step=1

  1. What do you plan on doing next week?

Next week I'd like to start working on vector legend implementation as it's very important part of my GSoC.

  1. Are you blocked on anything?

I am blocked on solving one problem with GUI. I worked on adding text labels into workspace with d.text module instead of wxPython text. It works now but only if I add just one text. Next week I need to solve the problem so the user can add more texts.

Week 6

Week 6, June, 27 - July, 1

  1. What did you get done this week?

I started work on new d.vect.legend module. For testing I created manually an input file that should be automatically generated in the future. I implemented option for input file, option for different delimiters used in file, different font, fontsize and fontcolor for title, group subtitle and legend items. So far I use some basic symbols from trunk the plan is to create new ones.

First version of vector legend

  1. What do you plan on doing next week?

I will work more on the module. The input file has to be generated automatically from GUI. New symbols for areas, lines and points have to be designed. Also one of my mentors asked me to participate at GRASS workshop at the summer school before ISPRS congress.

  1. Are you blocked on anything?

No.

Week 7

Week 6, July, 4 - July, 8

  1. What did you get done this week?

I worked on d.vect.legend module. I fixed options for different delimiters, optioon for background and aligning of labels to symbols. Also I participated at GRASS workshop during ISPRS Summer school with my mentor.

  1. What do you plan on doing next week?

This week during ISPRS in Prague we would llike to mmet with my mentors and discuss about the d.vect.legend module so we can decide what's the best way.

  1. Are you blocked on anything?

I need to solce how exactly continue with d.vect.module. We already decided that that python script is probably not enough so it will be C module but there are some questions about generating file.

Week 8

Week 8, July, 11 - July, 15

  1. What did you get done this week?

I met several times with my mentors. I fixed the bugs in d.legend #3098. I fixed the shifted side histogram and added option for units #3081. I fixed the option for transparent background. I fixed the transparency for d.northarrow #3044. I added some features to low-level module d.vect.legend. It can parse legend file and display vectorlegend now.

  1. What do you plan on doing next week?

I will meet again with my mentors. I will start implement the d.vect.legend into GUI and for d.mon command.

  1. Are you blocked on anything?

There were some blockers but with support of my mentors everything is OK.

Week 9

Week 9, July, 18 - July, 22

  1. What did you get done this week?

Unfortunatelly I was ill most of the week so I didn't work much. I worked on the vector legend. I created symbols for vector maps of type area and lines. I implemented first version of vector legend for GUI. I added option for legend label.

  1. What do you plan on doing next week?

There is still a lot of bugs to solve for vector legend in GUI. I will implement the vector legend for d.mon.

  1. Are you blocked on anything?

The GRASS symbol format is little bit confusing for me and it's not really easy create more sophisticated symbols and convert to png.

Week 10

Week 10, July, 25 - July, 29

  1. What did you get done this week?

I fixed a bug in d.legend module [3106] I worked on d.legend.vect module. I implemented the vector legend for GUI and d.mon. I designed some symbols for area and line vector maps.

  1. What do you plan on doing next week?

I will continue work on vector legend.

  1. Are you blocked on anything?

No.

Week 12

Week 12, August, 8 - August, 12

Wiki page: https://trac.osgeo.org/grass/wiki/GSoC/2016/BasicCartographySuiteInGRASS A link to my commits: (diff files and d.legend.vect AddOn): https://github.com/lazaa32/SoC16/commits

The goal of the project was to enhance some cartographic d.* modules, to fix some bugs in them and create a module for vector legend.

Before this summer some of the d.* modules were quite limited. User couldn't use full potential of modules and couldn't customize them, e.g. few symbols for north-arrow, option to rotate the arrow with/without label, set the length of scalebar, background settings... Before this summer there was no legend for vector maps.

The addition my project brought to GRASS: d.histogram - enhance of displaying labels d.grid - added options for labels background d.northarrow - added several new symbols, added option for rotation and custom label, background settings d.scalebar - added options for units, scalebar length, background settings d.legend - support for border and background, added options for displaying ticks, added options for setting steps and labels, added logarithmic scale, enhanced histogram option, added option for units workspace - enhance workspace setting behavior, include map elements into workspace d.legend.vect - new module for displaying legend of vector maps, created new symbols for areas and lines d.vect.thematic - enhance module for lines and points

Most of the changes are already at the latest version of GRASS. For the vector legend https://grass.osgeo.org/grass70/manuals/addons/d.legend.vect.html you can install it from GRASS with g.extension manager: g.extension extension=d.legend.vect operation=add

Attachments (15)

Note: See TracWiki for help on using the wiki.