Hi, On Tue, Feb 9, 2021 at 10:25 AM Chris Bartolomei via grass-user < grass-user@lists.osgeo.org> wrote:
> Good morning :) > I'm using GRASS 7.4.1 on a Linux cluster so I only have command-line > capability. I have two vector layers (a country boundary polygon and part > of an administrative area map - also polygons). I am trying to automate > creating a PNG file of the admin areas overlaying the country boundary > therefore all work has to be command-line (in a bash script). I've tried > this two ways - using the d.mon start=png method and also the ps.map method > as described below. The d.mon method appears to generate the image with > only one vector map (not both) and only colors the borders - it won't use > the fill_color setting. The ps.map method seems to work but assumes the > image is on a sheet of paper so there's a ton of extra white-space. I'd > like to use d.mon but I can use ps.map if someone could please let me know > how to export only the computational region without all the extra 'paper' > in the image. Here's my code: > > g.region vector='Country' > export GRASS_RENDER_IMMEDIATE=png > export GRASS_RENDER_WIDTH=640 > export GRASS_RENDER_HEIGHT=480 > export GRASS_RENDER_TRANSPARENT=true > export GRASS_RENDER_TRUECOLOR=true > export GRASS_RENDER_FILE=$HOME/country_admin.png > export GRASS_RENDER_FILE_COMPRESSION=0 > export GRASS_MESSAGE_FORMAT=plain > d.mon start=png > d.vect map=Country color=210:210:210 fill_color=153:153:153 display=shape > type=area > d.vect map=admin_area color=153:153:153 rgb_column=area_color > display=shape type=area > d.mon stop=png > > This only produces a png with the last vector listed and only the borders > are colored with the rgb_column values. > I think you are missing GRASS_RENDER_FILE_READ=TRUE: https://grass.osgeo.org/grass78/manuals/pngdriver.html Regarding rgb_column, I am not sure, didn't have time to test. Anna > > If I do this without the d.mon start/stop lines ... i.e. relying on the > GRASS_RENDER_IMMEDIATE=png only, then only one vector map is converted to > png however it DOES do the color fill properly. With either above method > the png is the correct size. > > Now using ps.map (same env variable set as above): > > g.region vector='Country' > ps.map input=$HOME/ps_rules.txt out=$HOME/country_admin.ps --overwrite > where ps_rules.txt is: > border y > color 81:81:81 > end > vareas admin_area > layer 1 > rgbcolumn area_color > color 153:153:153 > end > vareas Country > color 210:210:210 > fcolor 153:153:153 > end > > We don't have pstopng but we do have ghostscript: > > gs-dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dTextAlphaBits=4 > -dGraphicsAlphaBits=4 -r300 -sOutputFile=$HOME/country_admin.png $HOME/ > country_admin.ps > > This creates the correct image (color fills, etc) but has white margins > and a lot of white space below the image like it is printed at the top of > a piece of paper. > > does anyone have any idea how to create a png with multiple vector maps > overlaying each other (and not have the extra whitespace too)? > > v/r > Chris > _______________________________________________ > grass-user mailing list > grass-user@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/grass-user >
_______________________________________________ grass-user mailing list grass-user@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/grass-user