<div dir="ltr"><div dir="ltr">Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 9, 2021 at 10:25 AM Chris Bartolomei via grass-user <<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"><div dir="ltr">Good morning :)</div><div dir="ltr">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:</div><div dir="ltr"><br></div><div dir="ltr">g.region vector='Country'</div><div dir="ltr">export GRASS_RENDER_IMMEDIATE=png</div><div dir="ltr"><span>export GRASS_RENDER_WIDTH=640</span></div><div dir="ltr"><span><span>export GRASS_RENDER_HEIGHT=480</span></span></div><div dir="ltr"><span><span><span>export GRASS_RENDER_TRANSPARENT=true</span></span></span></div><div dir="ltr"><span><span><span><span>export GRASS_RENDER_TRUECOLOR=true</span></span></span></span></div><div dir="ltr"><span><span><span><span><span>export GRASS_RENDER_FILE=$HOME/country_admin.png</span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span><span>export GRASS_RENDER_FILE_COMPRESSION=0</span></span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span><span><span>export GRASS_MESSAGE_FORMAT=plain</span></span></span></span></span></span></span></div><div dir="ltr">d.mon start=png</div><div dir="ltr">d.vect map=Country color=210:210:210 fill_color=153:153:153 display=shape type=area</div><div dir="ltr">d<span>.vect map=admin_area color=<span><span>153:153:153</span></span> rgb_column=area_color display=shape type=area</span></div><div dir="ltr"><span>d.mon stop=png</span></div><div dir="ltr"><span><br></span></div><div dir="ltr"><span>This only produces a png with the last vector listed and only the borders are colored with the rgb_column values.</span></div></div></div></blockquote><div><br></div><div>I think you are missing  GRASS_RENDER_FILE_READ=TRUE:</div><div><a href="https://grass.osgeo.org/grass78/manuals/pngdriver.html">https://grass.osgeo.org/grass78/manuals/pngdriver.html</a><br></div><div><br></div><div>Regarding rgb_column, I am not sure, didn't have time to test.</div><div><br></div><div>Anna</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:16px"><div dir="ltr"><span><br></span></div><div dir="ltr"><span>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.</span></div><div dir="ltr"><span><br></span></div><div dir="ltr"><span>Now using ps.map (same env variable set as above):</span></div><div dir="ltr"><span><br></span></div><div dir="ltr"><span><span>g.region vector='Country'</span><br></span></div><div dir="ltr"><span>ps.map input=$HOME/ps_rules.txt out=<span><span><span><span><span><span>$HOME/country_admin.</span></span></span></span></span></span>ps --overwrite <br></span></div><div dir="ltr"><span>  where ps_rules.txt is:</span></div><div dir="ltr"><span></span>border y</div><div dir="ltr">  color 81:81:81</div><div dir="ltr">  end</div><div dir="ltr">vareas admin_area</div><div dir="ltr">  layer 1</div><div dir="ltr">  rgbcolumn area_color</div><div dir="ltr">  color 153:153:153</div><div dir="ltr">  end</div><div dir="ltr">vareas Country</div><div dir="ltr">  color 210:210:210</div><div dir="ltr">  fcolor 153:153:153</div><div dir="ltr">  end</div><div dir="ltr"><br></div><div dir="ltr">We don't have pstopng but we do have ghostscript:</div><div dir="ltr"><br></div><div dir="ltr">gs-dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r300 -sOutputFile=$HOME/<span><span><span><span><span><span><span><span>country_admin.</span></span></span></span></span></span>png $HOME/<span><span><span><span><span><span><span><span>country_admin.</span></span></span></span></span></span>p</span></span>s</span></span></div><div dir="ltr"><span><span><br></span></span></div><div dir="ltr"><span><span>This creates the correct image (color fills, etc) but has white margins and a lot of white space below the image like<span><span><span> it is printed at the top of a piece of paper.</span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span><br></span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span>does anyone have any idea how to create a png with multiple vector maps overlaying each other (and not have the extra whitespace too)?</span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span><br></span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span>v/r</span></span></span></span></span></div><div dir="ltr"><span><span><span><span><span>Chris</span></span></span></span></span><br></div></div></div>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</blockquote></div></div>