<div dir="ltr">Dear all,<div><br></div><div>I am trying to get output image files in various formats using the Cairo driver, following some very useful Python scripting examples:</div><div><a href="https://baharmon.github.io/python-in-grass">https://baharmon.github.io/python-in-grass</a></div><div><br></div><div>When I try to map vector layers (e.g., point data) on top of raster layers (say a digital elevation model);</div><div><br></div><div>if I use PNG output file extension, both vector and raster layers show up with points having transparent background,</div><div><br></div><div>if I use PDF, PS, or SVG output file extension, only the vector layer (drawn last) is shown in the output image with white background.</div><div><br></div><div>Maybe the PS driver is a better option?</div><div><br></div><div>Yet, I was reading this old grass-dev post that may be relevant:</div><div><a href="https://marc.info/?l=grass-dev&m=146346954429631&w=2">https://marc.info/?l=grass-dev&m=146346954429631&w=2</a><br></div><div><br></div><div>Kind regards,</div><div><br></div><div>Luigi</div><div><br></div><div><br></div><div><div>Sample test function I am using follows:</div><div><br></div><div><div style="color:rgb(0,0,0);line-height:23px;white-space:pre"><div><font face="monospace"><span style="color:rgb(0,0,255)">def</span> make_map(outfile_name,</font></div><div><font face="monospace">             fig_width,</font></div><div><font face="monospace">             fig_height,</font></div><div><font face="monospace">             bg_color: Optional[str] = <span style="color:rgb(0,0,255)">None</span>,</font></div><div><font face="monospace">             file_types: Optional[list] = <span style="color:rgb(0,0,255)">None</span>):</font></div><div><font face="monospace">    <span style="color:rgb(163,21,21)">""" Test ouput map figure.</span></font></div><div><span style="color:rgb(163,21,21)"><font face="monospace">        PLEASE CHECK as PDF and PS output does not get vectors displayed on</font></span></div><div><span style="color:rgb(163,21,21)"><font face="monospace">        top of rasters. """</font></span></div><div><font face="monospace">    background_color = bg_color <span style="color:rgb(0,0,255)">or</span> [NO_BG_COLOR]</font></div><div><font face="monospace">    extensions = [PNG] <span style="color:rgb(0,0,255)">if</span> file_types <span style="color:rgb(0,0,255)">is</span> <span style="color:rgb(0,0,255)">None</span> <span style="color:rgb(0,0,255)">else</span> file_types</font></div><div><font face="monospace">    <span style="color:rgb(0,0,255)">for</span> extension <span style="color:rgb(0,0,255)">in</span> extensions:</font></div><div><font face="monospace">        outfile = pathlib.Path(OUT_DIR).joinpath(<span style="color:rgb(0,0,255)">f</span><span style="color:rgb(163,21,21)">"</span>{outfile_name}<span style="color:rgb(163,21,21)">.</span>{extension}<span style="color:rgb(163,21,21)">"</span>)</font></div><div><font face="monospace">        grass.run_command(<span style="color:rgb(163,21,21)">"d.mon"</span>, overwrite=<span style="color:rgb(0,0,255)">True</span>,</font></div><div><font face="monospace">                          start=<span style="color:rgb(163,21,21)">"cairo"</span>,</font></div><div><font face="monospace">                          width=fig_width,</font></div><div><font face="monospace">                          height=fig_height,</font></div><div><font face="monospace">                          bgcolor=background_color,</font></div><div><font face="monospace">                          output=outfile)</font></div><div><font face="monospace">        grass.run_command(<span style="color:rgb(163,21,21)">"d.rast"</span>,</font></div><div><font face="monospace">                          map=<span style="color:rgb(163,21,21)">"raster_layer"</span>)</font></div><div><font face="monospace">        grass.run_command(<span style="color:rgb(163,21,21)">"d.vect"</span>,</font></div><div><font face="monospace">                          map=<span style="color:rgb(163,21,21)">"point_vector_layer"</span>,</font></div><div><font face="monospace">                          type=<span style="color:rgb(163,21,21)">"point"</span>,</font></div><div><font face="monospace">                          color=<span style="color:rgb(163,21,21)">"150:0:0"</span>,</font></div><div><font face="monospace">                          size=<span style="color:rgb(9,134,88)">20</span>)</font></div><div><font face="monospace">        <span style="color:rgb(0,128,0)"># all other display commands</span></font></div><div><font face="monospace">        grass.run_command(<span style="color:rgb(163,21,21)">"d.mon"</span>, stop=<span style="color:rgb(163,21,21)">"cairo"</span>)</font></div></div></div></div><div><br></div><div><br></div><div>Bundled GRASS app for Mac from here:</div><div><a href="http://grassmac.wikidot.com/downloads">http://grassmac.wikidot.com/downloads</a><br></div><div><br></div><div>System Info: <br></div><div><br></div><div>GRASS version: <a href="http://8.0.dev">8.0.dev</a>                                                          <br>Code revision: 32930185c                                                        <br>Build date: 2021-07-01                                                          <br>Build platform: x86_64-apple-darwin20.5.0                                       <br>GDAL: 3.1.4                                                                     <br>PROJ: 7.1.1                                                                     <br>GEOS: 3.8.1                                                                     <br>SQLite: 3.35.4                                                                  <br>Python: 3.8.8                                                                   <br>wxPython: 4.1.1                                                                 <br>Platform: macOS-10.16-x86_64-i386-64bit                                         <br></div><div><br></div><div>g.version -b<br>GRASS <a href="http://8.0.dev">8.0.dev</a> (2021)<br><br> ./configure  --with-macosx-sdk=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk --enable-64bit --with-macosx-archs=x86_64 --with-opengl=aqua --with-openmp --prefix=/Applications/GRASS-8.0.app/Contents/Resources --with-freetype --with-freetype-includes=/Applications/GRASS-8.0.app/Contents/Resources/include/freetype2 --with-freetype-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-gdal=/Applications/GRASS-8.0.app/Contents/Resources/bin/gdal-config --with-gdal-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-proj=/Applications/GRASS-8.0.app/Contents/Resources/bin/proj --with-proj-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-proj-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-proj-share=/Applications/GRASS-8.0.app/Contents/Resources/share/proj --with-geos=/Applications/GRASS-8.0.app/Contents/Resources/bin/geos-config --with-jpeg-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-jpeg-libs=//Applications/GRASS-8.0.app/Contents/Resources/lib --with-png-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-png-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-tiff-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-tiff-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-postgres=yes --with-postgres-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-postgres-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --without-mysql --with-sqlite --with-sqlite-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-sqlite-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-fftw-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-fftw-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-cxx --with-cairo --with-cairo-includes=/Applications/GRASS-8.0.app/Contents/Resources/include/cairo --with-cairo-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-cairo-ldflags=-lcairo --with-zstd --with-zstd-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-zstd-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-bzlib --with-bzlib-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-bzlib-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-netcdf=/Applications/GRASS-8.0.app/Contents/Resources/bin/nc-config --with-blas --with-blas-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-blas-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-lapack --with-lapack-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-lapack-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-netcdf=/Applications/GRASS-8.0.app/Contents/Resources/bin/nc-config --with-nls --with-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-includes=/Applications/GRASS-8.0.app/Contents/Resources/include --with-pdal=/Applications/GRASS-8.0.app/Contents/Resources/bin/pdal-config --with-pdal-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-readline --with-readline-includes=/Applications/GRASS-8.0.app/Contents/Resources/include/readline --with-readline-libs=/Applications/GRASS-8.0.app/Contents/Resources/lib --with-liblas=/Applications/GRASS-8.0.app/Contents/Resources/bin/liblas-config<br></div><div><div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr">Luigi Ponti<br><br></div><div dir="ltr"><br></div></div></div></div></div>