How to generate a vector graphics file from GRASS CLI?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

How to generate a vector graphics file from GRASS CLI?

Ken Mankoff
Hi,

I'm trying to generate a vector graphics file (PDF, but EPS or PS is fine) from the GRASS CLI. I'd like to have both raster and vector output. When I follow the simple examples from PSDRIVER or CAIRO the result is always the same - only the last graphic appears. It is as though there is a "d.erase" between every command.

From https://grass.osgeo.org/grass76/manuals/psdriver.html

export GRASS_RENDER_IMMEDIATE=ps
export GRASS_RENDER_TRUECOLOR=TRUE
g.region raster=elevation
d.rast elevation
d.vect roadsmajor color=red

Only shows roads, no elevation.

I can get what I want with the PNG driver, but those graphics are not publication quality.

Thanks,

  -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

st_kiefer
Hi Ken,
have you considered using ps.map?

https://grass.osgeo.org/grass76/manuals/ps.map.html

regards

Stefan

> Ken Mankoff <[hidden email]> hat am 29. Januar 2019 um 08:43 geschrieben:
>
>
> Hi,
>
> I'm trying to generate a vector graphics file (PDF, but EPS or PS is fine) from the GRASS CLI. I'd like to have both raster and vector output. When I follow the simple examples from PSDRIVER or CAIRO the result is always the same - only the last graphic appears. It is as though there is a "d.erase" between every command.
>
> From https://grass.osgeo.org/grass76/manuals/psdriver.html
>
> export GRASS_RENDER_IMMEDIATE=ps
> export GRASS_RENDER_TRUECOLOR=TRUE
> g.region raster=elevation
> d.rast elevation
> d.vect roadsmajor color=red
>
> Only shows roads, no elevation.
>
> I can get what I want with the PNG driver, but those graphics are not publication quality.
>
> Thanks,
>
>   -k.
> _______________________________________________
> grass-user mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

NikosAlexandris
In reply to this post by Ken Mankoff
* Ken Mankoff <[hidden email]> [2019-01-29 08:43:56 +0100]:

>Hi,
>
>I'm trying to generate a vector graphics file (PDF, but EPS or PS is fine) from the GRASS CLI. I'd like to have both raster and vector output. When I follow the simple examples from PSDRIVER or CAIRO the result is always the same - only the last graphic appears. It is as though there is a "d.erase" between every command.
>
>From https://grass.osgeo.org/grass76/manuals/psdriver.html
>
>export GRASS_RENDER_IMMEDIATE=ps
>export GRASS_RENDER_TRUECOLOR=TRUE
>g.region raster=elevation
>d.rast elevation
>d.vect roadsmajor color=red
>
>Only shows roads, no elevation.

Same here, with a different raster and vector map. Drawing my raster
map gives a 48M file. Then, drawing my vector map ends up with a 1.18M
file.

Nikos

[rest deleted]
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff
In reply to this post by st_kiefer
I will look into ps.map. I was hoping for something simpler. 

Please excuse brevity. Sent from tiny pocket computer with non-haptic feedback keyboard.

On Tue, Jan 29, 2019, 09:28 <[hidden email] wrote:
Hi Ken,
have you considered using ps.map?

https://grass.osgeo.org/grass76/manuals/ps.map.html

regards

Stefan

> Ken Mankoff <[hidden email]> hat am 29. Januar 2019 um 08:43 geschrieben:
>
>
> Hi,
>
> I'm trying to generate a vector graphics file (PDF, but EPS or PS is fine) from the GRASS CLI. I'd like to have both raster and vector output. When I follow the simple examples from PSDRIVER or CAIRO the result is always the same - only the last graphic appears. It is as though there is a "d.erase" between every command.
>
> From https://grass.osgeo.org/grass76/manuals/psdriver.html
>
> export GRASS_RENDER_IMMEDIATE=ps
> export GRASS_RENDER_TRUECOLOR=TRUE
> g.region raster=elevation
> d.rast elevation
> d.vect roadsmajor color=red
>
> Only shows roads, no elevation.
>
> I can get what I want with the PNG driver, but those graphics are not publication quality.
>
> Thanks,
>
>   -k.
> _______________________________________________
> grass-user mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

st_kiefer
Give it a try. ps.map is not that complicated. The manual page even offers an out of the box template for instant results (just scroll to the end).
And if you get familiar with that tool you can produce very convincing graphics for publications, with graphically additions of your liking.

cheers

Stefan

> Ken Mankoff <[hidden email]> hat am 29. Januar 2019 um 11:20 geschrieben:
>
>
> I will look into ps.map. I was hoping for something simpler.
>
> Please excuse brevity. Sent from tiny pocket computer with non-haptic
> feedback keyboard.
>
> On Tue, Jan 29, 2019, 09:28 <[hidden email] wrote:
>
> > Hi Ken,
> > have you considered using ps.map?
> >
> > https://grass.osgeo.org/grass76/manuals/ps.map.html
> >
> > regards
> >
> > Stefan
> >
> > > Ken Mankoff <[hidden email]> hat am 29. Januar 2019 um 08:43
> > geschrieben:
> > >
> > >
> > > Hi,
> > >
> > > I'm trying to generate a vector graphics file (PDF, but EPS or PS is
> > fine) from the GRASS CLI. I'd like to have both raster and vector output.
> > When I follow the simple examples from PSDRIVER or CAIRO the result is
> > always the same - only the last graphic appears. It is as though there is a
> > "d.erase" between every command.
> > >
> > > From https://grass.osgeo.org/grass76/manuals/psdriver.html
> > >
> > > export GRASS_RENDER_IMMEDIATE=ps
> > > export GRASS_RENDER_TRUECOLOR=TRUE
> > > g.region raster=elevation
> > > d.rast elevation
> > > d.vect roadsmajor color=red
> > >
> > > Only shows roads, no elevation.
> > >
> > > I can get what I want with the PNG driver, but those graphics are not
> > publication quality.
> > >
> > > Thanks,
> > >
> > >   -k.
> > > _______________________________________________
> > > grass-user mailing list
> > > [hidden email]
> > > https://lists.osgeo.org/mailman/listinfo/grass-user
> > _______________________________________________
> > grass-user mailing list
> > [hidden email]
> > https://lists.osgeo.org/mailman/listinfo/grass-user
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff

On 2019-01-29 at 11:48 +0100, [hidden email] wrote...
> Give it a try. ps.map is not that complicated. The manual page even
> offers an out of the box template for instant results (just scroll to
> the end). And if you get familiar with that tool you can produce very
> convincing graphics for publications, with graphically additions of
> your liking.

You're right - it is easy.

One issue - I can't reference map@mapset. I have to g.copy map@mapset,map and then reference just "map". Am I missing something or is this a real limitation?

  -k.

_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Veronica Andreo
Hi

El mar., 29 ene. 2019 a las 13:57, Ken Mankoff (<[hidden email]>) escribió:

On 2019-01-29 at 11:48 +0100, [hidden email] wrote...
> Give it a try. ps.map is not that complicated. The manual page even
> offers an out of the box template for instant results (just scroll to
> the end). And if you get familiar with that tool you can produce very
> convincing graphics for publications, with graphically additions of
> your liking.

You're right - it is easy.

One issue - I can't reference map@mapset. I have to g.copy map@mapset,map and then reference just "map". Am I missing something or is this a real limitation?

I just tested with the cartographic composer GUI (g.gui.psmap) and with command line ps.map, and as long as the other mapset is accessible, no problems with fully qualified map names, i.e., map@mapset. No need to copy maps, you can use map@mapset in the instruction file

cheers,
Vero


_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff

On 2019-01-29 at 18:42 +0100, Veronica Andreo <[hidden email]> wrote...
> I just tested with the cartographic composer GUI (g.gui.psmap) and
> with command line ps.map, and as long as the other mapset is
> accessible, no problems with fully qualified map names, i.e.,
> map@mapset. No need to copy maps, you can use map@mapset in the
> instruction file

OK - maybe there was something else that was causing the problem for me. Thank you for testing and letting me know this does work.

  -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff
In reply to this post by st_kiefer
Hello,

On 2019-01-29 at 11:48 +0100, [hidden email] wrote...
> Give it a try. ps.map is not that complicated. The manual page even
> offers an out of the box template for instant results (just scroll to
> the end). And if you get familiar with that tool you can produce very
> convincing graphics for publications, with graphically additions of
> your liking.

One more ps.map question. What is the best/easiest method to patch together multiple rasters with different colors?

I have two raster basemaps plus a velocity raster map.
One basemap is the output of r.shade (a colored shaded relief map).
One basemap is the output of r.relief (a grayscale shaded map)
The velocity raster has its own color scale.

I'd like all three in ps.map, but understand there is a one-raster limitation (any good reason for this?). How do I patch them but maintain distinct colors?

Thanks,

  -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff

On 2019-02-02 at 11:51 +0100, Ken Mankoff <[hidden email]> wrote...
> One more ps.map question. What is the best/easiest method to patch
> together multiple rasters with different colors?

From https://grasswiki.osgeo.org/wiki/Ps.map_scripts

"""If you want to show two or more overlapping raster maps you need to combine them with the r.patch module or r.mapcalc's '#' color operator. (see also the r.his and r.composite modules)"""

  -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

NikosAlexandris
* Ken Mankoff <[hidden email]> [2019-02-02 13:51:43 +0100]:

>
>On 2019-02-02 at 11:51 +0100, Ken Mankoff <[hidden email]> wrote...
>> One more ps.map question. What is the best/easiest method to patch
>> together multiple rasters with different colors?
>
>From https://grasswiki.osgeo.org/wiki/Ps.map_scripts
>
>"""If you want to show two or more overlapping raster maps you need to combine them with the r.patch module or r.mapcalc's '#' color operator. (see also the r.his and r.composite modules)"""
>
>  -k.

Ken, there is also https://grass.osgeo.org/grass77/manuals/r.blend.html.

Nikos
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

Ken Mankoff
Hi Nikos,

On 2019-02-03 at 18:45 +0100, Nikos Alexandris <[hidden email]> wrote...

> there is also
> https://grass.osgeo.org/grass77/manuals/r.blend.html.

Thanks - looks useful.

I ended up with:

r.mapcalc and "r#..." to split 5 different rasters into RGB channels.
r.patch'ing 3x (5x r, 5x g, 5x b)

then rgb displaying the patched rasters in ps.map.

r.blend looks easier. But I'm not sure how to keep things spread evenly and looking good for >2 rasters.

Is there any deep technical reason ps.map does not accept >1 raster? I don't want to start GUI programming, but from the command line it seems like this could be a tractable first major contribution to the GRASS code, depending on the reasons it doesn't exist.

  -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user
Reply | Threaded
Open this post in threaded view
|

Re: How to generate a vector graphics file from GRASS CLI?

st_kiefer
In reply to this post by Ken Mankoff
Hi Ken,
unfotunately i have not tested that so far, but outside grass I used virtual raster many times for this purpose. You might try to harness r.buildvrt to combine different raster-layer (or have a look for GDAL .vrt-files). So i use this to keep smal raster files but get large combined extends. This should work for overlappings as well. But as I said, I did not verify this.

https://grass.osgeo.org/grass77/manuals/r.buildvrt.html

cheers

Stefan

> Ken Mankoff <[hidden email]> hat am 2. Februar 2019 um 11:51 geschrieben:
>
>
> Hello,
>
> On 2019-01-29 at 11:48 +0100, [hidden email] wrote...
> > Give it a try. ps.map is not that complicated. The manual page even
> > offers an out of the box template for instant results (just scroll to
> > the end). And if you get familiar with that tool you can produce very
> > convincing graphics for publications, with graphically additions of
> > your liking.
>
> One more ps.map question. What is the best/easiest method to patch together multiple rasters with different colors?
>
> I have two raster basemaps plus a velocity raster map.
> One basemap is the output of r.shade (a colored shaded relief map).
> One basemap is the output of r.relief (a grayscale shaded map)
> The velocity raster has its own color scale.
>
> I'd like all three in ps.map, but understand there is a one-raster limitation (any good reason for this?). How do I patch them but maintain distinct colors?
>
> Thanks,
>
>   -k.
_______________________________________________
grass-user mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/grass-user