[GRASS-user] creating map series purely on ps.map

Hi,

Basically my workflow for creating paper maps is create the main map
in ps.map. Export the ps output to pdf or png in a graphics software
(scribus or illustrator). Edit all map elements legend, anotations,
etc.

What I want is to be bale to create the map purely within grass and
ps.map module.

Several questions:
1. I need to prepare separate mapsheets of landcover data. I have a
vector layer in grass of all the boundingboxes. How can I call ps.map
to create mapsheets using the individual boundingboxes as the region
settings?

2. Each mapsheet requires a different locatormap as reference. How do
I add the locatormap using a bigger region settings around the mapped
region settings?

3. Legend symbology for different landcover categories within a single
polygon vector. As a workaround, I separate landcover categories as
separate vector layers.

4. Tips and tricks for different annotations.

5. Combine different ps.map output into one map.

Any advice? Thanks in advance!
--
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------

maning wrote:

Basically my workflow for creating paper maps is create the
main map in ps.map. Export the ps output to pdf or png in a
graphics software (scribus or illustrator). Edit all map elements
legend, anotations, etc.

What I want is to be bale to create the map purely within
grass and ps.map module.

sure, it's possible.

Several questions:
1. I need to prepare separate mapsheets of landcover data. I have a
vector layer in grass of all the boundingboxes. How can I call ps.map
to create mapsheets using the individual boundingboxes as the region
settings?

hmmm how to extract the bounding box of each category in a vector map?
I think there might be a way, but I'm not sure, maybe someone else knows.

anyway you can write a shell loop to use v.extract to pull out that
one category and then use "g.region vect=extract_cat_$CAT" to zoom in
on that one area. If you want a buffer around it, try like:

g.region vect=$MAP
g.region res=5000 -a

which will grow outwards until it hits a 5km round number.

while you are there save the region with 'g.region save=' with a name
derived from that box name so you can jump to it quickly later on.

something like

for CAT in `v.category master_bounding_box_map option=print` ; do
   v.extract in=master_bounding_box_map out=bbox_$CAT list=$CAT
   g.region -d
   g.region vect=bbox_$CAT
   g.region res=5000 -a
   g.region res=10 # back to normal for raster map res
   g.region save=bbox_$CAT
done

then

for REGION in `g.mlist region pattern=bbox_*` ; do
   g.region region=$REGION
   ps.map out=landcover_$REGION in=- << EOF
       ....
       end
EOF
   ps2pdf landcover_$REGION.ps
done

2. Each mapsheet requires a different locatormap as reference. How
do I add the locatormap using a bigger region settings around
the mapped region settings?

inlays:
first for each mapsheet save a region with 'g.region save='.
then (in a loop) create a ps.map .eps file drawing the overview
map but also using the ps.map "region" instruction to draw a box
over the top of it. I like to use a red frame with width of 2,
but you'll have to experiment with the width as this .eps will be
much smaller on the page once it is embedded. Because it will be
so reduced you can probably set the resolution quite coarse, with
a little math you can figure out how many raster column cells equate
to 300dpi at your target width (e.g. if you want the inset to be 2"
wide set the region resolution to be so columns is about 600 cells.)

once you have those just use the ps.map 'eps' instruction to place
them on the map. Use the 'rectangle' instruction to add a thicker
border if you like.

again, if you write the script like this:

for MAP in `g.mlist rast patter=*.landuse` ; do
   case "$MAP" in
      landuse23)
         MAP_TITLE="Map of landuse category 23"
         ;;
       landuse24)
         MAP_TITLE= ...
         ;;
   esac

   ps.map out=$MAP.ps in=- << EOF
      raster $MAP
      eps 10% 10%
        epsfile locator_$MAP.eps
        scale 0.2
        end
      text 650000 7365000 Landuse for $MAP_TITLE
        end
      end
EOF

then you can use shell variable replacement within the instruction file.
another way is to have a shell script write a bunch of files instead of
running ps.map directly; or just make a master instruction file then copy
it a bunch of times and tweak each individually. that last way is a pain
if you decide to change anything though, as you have to make the edit
in every copy of the file.

you can put the non changing bits in a template file and then do like:

for MAP in `g.mlist` ; do
  ps.map out=test.ps in=- << EOF
     raster $MAP
     eps ..
       epsfile region.$MAP
       end
     `cat common_instructions.txt`
     end
EOF

3. Legend symbology for different landcover categories within a single
polygon vector. As a workaround, I separate landcover categories as
separate vector layers.

you can keep them all in the same file, just repeat the vareas command
but limit by SQL query each time, and set the "label" for each vareas
as needed. see example here:
http://grass.osgeo.org/wiki/Psmap_fill_patterns
http://grass.osgeo.org/wiki/AreaFillPatterns

4. Tips and tricks for different annotations.

you'd have to be more specific about what you mean. many tips here:
  http://grass.osgeo.org/wiki/Ps.map
  http://grass.osgeo.org/wiki/IconSymbols#North_Arrows

see also ps.output in wiki addons.

5. Combine different ps.map output into one map.

see
http://grass.osgeo.org/wiki/Ps.map_scripts#Multiple_raster_images

feel free to add anything useful to those wiki pages.

Hamish

Hello,

I used v.to.rast
    v.to.rast --overwrite input=inmap output=outmap use=cat
to convert 29 areas to raster.

It says
    Converted areas: 29 of 29
but one area is missing!!!

Its the one with cat number 16. Doing the same just for the selected 16,
conversion results in am empty raster map.

the same with use=attr or usr=val. Another vector map also does not
convert some areas. The missing areas are not special

What happens? Magic?

I tried it with grass64 and newly compiled grass65. (OpenSuse 11.1 64bit)

Achim

PS:
Layer: 1
Typ Anzahl Min Max
Punkt 0 0 0
Linie 0 0 0
Grenze 0 0 0
Zentroid 29 1 29
Fläche 0 0 0
Alle 29 1 29

Hi,

using a new location: no success

export and import as shape-file: no success

reproduce it with spearfish dataset: no success

Has anybody an idea?

I attach the problem-polygon as a shape... hope somebody has the same
problem with it ...and an idea.

Thanks,
Achim

achim schrieb:

Hello,

I used v.to.rast
    v.to.rast --overwrite input=inmap output=outmap use=cat
to convert 29 areas to raster.

It says
    Converted areas: 29 of 29
but one area is missing!!!

Its the one with cat number 16. Doing the same just for the selected 16,
conversion results in am empty raster map.

the same with use=attr or usr=val. Another vector map also does not
convert some areas. The missing areas are not special

What happens? Magic?

I tried it with grass64 and newly compiled grass65. (OpenSuse 11.1 64bit)

Achim

PS:
Layer: 1
Typ Anzahl Min Max
Punkt 0 0 0
Linie 0 0 0
Grenze 0 0 0
Zentroid 29 1 29
Fläche 0 0 0
Alle 29 1 29
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

(attachments)

grass.zip (14.2 KB)

Hi,

I tried a lot. And I found a solution:

I made a buffer around the area with 0 distance. Then v.to.rast works.

If anyone knows why, it would be very interesting for me.

Moreover, when this happens in a big dataset, the error will probably
not recognized.

Thanks for attention,
Achim

achim schrieb:

Hi,

using a new location: no success

export and import as shape-file: no success

reproduce it with spearfish dataset: no success

Has anybody an idea?

I attach the problem-polygon as a shape... hope somebody has the same
problem with it ...and an idea.

Thanks,
Achim

achim schrieb:

Hello,

I used v.to.rast
    v.to.rast --overwrite input=inmap output=outmap use=cat
to convert 29 areas to raster.

It says
    Converted areas: 29 of 29
but one area is missing!!!

Its the one with cat number 16. Doing the same just for the selected 16,
conversion results in am empty raster map.

the same with use=attr or usr=val. Another vector map also does not
convert some areas. The missing areas are not special

What happens? Magic?

I tried it with grass64 and newly compiled grass65. (OpenSuse 11.1 64bit)

Achim

PS:
Layer: 1
Typ Anzahl Min Max
Punkt 0 0 0
Linie 0 0 0
Grenze 0 0 0
Zentroid 29 1 29
Fläche 0 0 0
Alle 29 1 29
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

------------------------------------------------------------------------

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Hi Achim,

could you, please, share with us your region -p ?

bests

milton

2009/8/20 achim <ak7@jupiter.uni-freiburg.de>

Hi,

I tried a lot. And I found a solution:

I made a buffer around the area with 0 distance. Then v.to.rast works.

If anyone knows why, it would be very interesting for me.

Moreover, when this happens in a big dataset, the error will probably
not recognized.

Thanks for attention,
Achim

achim schrieb:

Hi,

using a new location: no success

export and import as shape-file: no success

reproduce it with spearfish dataset: no success

Has anybody an idea?

I attach the problem-polygon as a shape… hope somebody has the same
problem with it …and an idea.

Thanks,
Achim

achim schrieb:

Hello,

I used v.to.rast
v.to.rast --overwrite input=inmap output=outmap use=cat
to convert 29 areas to raster.

It says
Converted areas: 29 of 29
but one area is missing!!!

Its the one with cat number 16. Doing the same just for the selected 16,
conversion results in am empty raster map.

the same with use=attr or usr=val. Another vector map also does not
convert some areas. The missing areas are not special

What happens? Magic?

I tried it with grass64 and newly compiled grass65. (OpenSuse 11.1 64bit)

Achim

PS:
Layer: 1
Typ Anzahl Min Max
Punkt 0 0 0
Linie 0 0 0
Grenze 0 0 0
Zentroid 29 1 29
Fläche 0 0 0
Alle 29 1 29


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user



grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Thanks hamish! I will try you suggestions back at work. Most of my
queries where answered.
One of my question, I discovered that when I open the .ps file to
Adobe Illustrator. It seems that the whole vector layer is included
with the a white foreground mask outside the region settings.

Am I correct that the vector is not "clipped" within the region settings?

On 8/20/09, Hamish <hamish_b@yahoo.com> wrote:

maning wrote:

Basically my workflow for creating paper maps is create the
main map in ps.map. Export the ps output to pdf or png in a
graphics software (scribus or illustrator). Edit all map elements
legend, anotations, etc.

What I want is to be bale to create the map purely within
grass and ps.map module.

sure, it's possible.

Several questions:
1. I need to prepare separate mapsheets of landcover data. I have a
vector layer in grass of all the boundingboxes. How can I call ps.map
to create mapsheets using the individual boundingboxes as the region
settings?

hmmm how to extract the bounding box of each category in a vector map?
I think there might be a way, but I'm not sure, maybe someone else knows.

anyway you can write a shell loop to use v.extract to pull out that
one category and then use "g.region vect=extract_cat_$CAT" to zoom in
on that one area. If you want a buffer around it, try like:

g.region vect=$MAP
g.region res=5000 -a

which will grow outwards until it hits a 5km round number.

while you are there save the region with 'g.region save=' with a name
derived from that box name so you can jump to it quickly later on.

something like

for CAT in `v.category master_bounding_box_map option=print` ; do
   v.extract in=master_bounding_box_map out=bbox_$CAT list=$CAT
   g.region -d
   g.region vect=bbox_$CAT
   g.region res=5000 -a
   g.region res=10 # back to normal for raster map res
   g.region save=bbox_$CAT
done

then

for REGION in `g.mlist region pattern=bbox_*` ; do
   g.region region=$REGION
   ps.map out=landcover_$REGION in=- << EOF
       ....
       end
EOF
   ps2pdf landcover_$REGION.ps
done

2. Each mapsheet requires a different locatormap as reference. How
do I add the locatormap using a bigger region settings around
the mapped region settings?

inlays:
first for each mapsheet save a region with 'g.region save='.
then (in a loop) create a ps.map .eps file drawing the overview
map but also using the ps.map "region" instruction to draw a box
over the top of it. I like to use a red frame with width of 2,
but you'll have to experiment with the width as this .eps will be
much smaller on the page once it is embedded. Because it will be
so reduced you can probably set the resolution quite coarse, with
a little math you can figure out how many raster column cells equate
to 300dpi at your target width (e.g. if you want the inset to be 2"
wide set the region resolution to be so columns is about 600 cells.)

once you have those just use the ps.map 'eps' instruction to place
them on the map. Use the 'rectangle' instruction to add a thicker
border if you like.

again, if you write the script like this:

for MAP in `g.mlist rast patter=*.landuse` ; do
   case "$MAP" in
      landuse23)
         MAP_TITLE="Map of landuse category 23"
         ;;
       landuse24)
         MAP_TITLE= ...
         ;;
   esac

   ps.map out=$MAP.ps in=- << EOF
      raster $MAP
      eps 10% 10%
        epsfile locator_$MAP.eps
        scale 0.2
        end
      text 650000 7365000 Landuse for $MAP_TITLE
        end
      end
EOF

then you can use shell variable replacement within the instruction file.
another way is to have a shell script write a bunch of files instead of
running ps.map directly; or just make a master instruction file then copy
it a bunch of times and tweak each individually. that last way is a pain
if you decide to change anything though, as you have to make the edit
in every copy of the file.

you can put the non changing bits in a template file and then do like:

for MAP in `g.mlist` ; do
  ps.map out=test.ps in=- << EOF
     raster $MAP
     eps ..
       epsfile region.$MAP
       end
     `cat common_instructions.txt`
     end
EOF

3. Legend symbology for different landcover categories within a single
polygon vector. As a workaround, I separate landcover categories as
separate vector layers.

you can keep them all in the same file, just repeat the vareas command
but limit by SQL query each time, and set the "label" for each vareas
as needed. see example here:
http://grass.osgeo.org/wiki/Psmap_fill_patterns
http://grass.osgeo.org/wiki/AreaFillPatterns

4. Tips and tricks for different annotations.

you'd have to be more specific about what you mean. many tips here:
  http://grass.osgeo.org/wiki/Ps.map
  http://grass.osgeo.org/wiki/IconSymbols#North_Arrows

see also ps.output in wiki addons.

5. Combine different ps.map output into one map.

see
http://grass.osgeo.org/wiki/Ps.map_scripts#Multiple_raster_images

feel free to add anything useful to those wiki pages.

Hamish

--
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------

maning wrote:

One of my question, I discovered that when I open the .ps file to
Adobe Illustrator. It seems that the whole vector layer is included
with the a white foreground mask outside the region settings.

Am I correct that the vector is not "clipped" within the
region settings?

To be honest, I don't know.

Hamish

sure, its the nile catchment at:
4326

projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 31:27:30N
south: 4:01:30S
west: 23:27E
east: 39:48E
nsres: 0:00:30
ewres: 0:00:30
rows: 4258
cols: 1962
cells: 8354196

Milton Cezar Ribeiro schrieb:

Hi Achim,

could you, please, share with us your region -p ?

bests

milton

2009/8/20 achim <ak7@jupiter.uni-freiburg.de
<mailto:ak7@jupiter.uni-freiburg.de>>

    Hi,

    I tried a lot. And I found a solution:

    I made a buffer around the area with 0 distance. Then v.to.rast works.

    If anyone knows why, it would be very interesting for me.

    Moreover, when this happens in a big dataset, the error will probably
    not recognized.

    Thanks for attention,
    Achim

    achim schrieb:
    > Hi,
    >
    > using a new location: no success
    >
    > export and import as shape-file: no success
    >
    > reproduce it with spearfish dataset: no success
    >
    > Has anybody an idea?
    >
    > I attach the problem-polygon as a shape... hope somebody has the same
    > problem with it ...and an idea.
    >
    > Thanks,
    > Achim
    >
    > achim schrieb:
    >> Hello,
    >>
    >> I used v.to.rast
    >> v.to.rast --overwrite input=inmap output=outmap use=cat
    >> to convert 29 areas to raster.
    >>
    >> It says
    >> Converted areas: 29 of 29
    >> but one area is missing!!!
    >>
    >> Its the one with cat number 16. Doing the same just for the
    selected 16,
    >> conversion results in am empty raster map.
    >>
    >> the same with use=attr or usr=val. Another vector map also does not
    >> convert some areas. The missing areas are not special
    >>
    >> What happens? Magic?
    >>
    >> I tried it with grass64 and newly compiled grass65. (OpenSuse
    11.1 64bit)
    >>
    >> Achim
    >>
    >> PS:
    >> Layer: 1
    >> Typ Anzahl Min Max
    >> Punkt 0 0 0
    >> Linie 0 0 0
    >> Grenze 0 0 0
    >> Zentroid 29 1 29
    >> Fläche 0 0 0
    >> Alle 29 1 29
    >> _______________________________________________
    >> grass-user mailing list
    >> grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    >> http://lists.osgeo.org/mailman/listinfo/grass-user
    >>
    >>
    ------------------------------------------------------------------------
    >>
    >> _______________________________________________
    >> grass-user mailing list
    >> grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    >> http://lists.osgeo.org/mailman/listinfo/grass-user
    _______________________________________________
    grass-user mailing list
    grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    http://lists.osgeo.org/mailman/listinfo/grass-user

Its all about the resolution!

raster-resolution has effects on some vector-operations. It seems, that
eg. some tools in v.clean (problem getting correct areas from bounds,
adding centros after using v.clean).

The same is with v.to.rast, which is obvious. But converting the
formerly attached polygon works just in an higher resolution (g.region
res=0:00:05).

This higher resolution (and 0:00:10) was used to run some filters in
order to get a special buffer needed to combine areas with lines.

The question remains: why do some polygons be converted correctly? Same
with cleaning a vector and making areas? Is there a problem with averaging?

Best regards,
Achim

achim schrieb:

sure, its the nile catchment at:
4326

projection: 3 (Latitude-Longitude)
zone: 0
datum: wgs84
ellipsoid: wgs84
north: 31:27:30N
south: 4:01:30S
west: 23:27E
east: 39:48E
nsres: 0:00:30
ewres: 0:00:30
rows: 4258
cols: 1962
cells: 8354196

Milton Cezar Ribeiro schrieb:

Hi Achim,

could you, please, share with us your region -p ?

bests

milton

2009/8/20 achim <ak7@jupiter.uni-freiburg.de
<mailto:ak7@jupiter.uni-freiburg.de>>

    Hi,

    I tried a lot. And I found a solution:

    I made a buffer around the area with 0 distance. Then v.to.rast works.

    If anyone knows why, it would be very interesting for me.

    Moreover, when this happens in a big dataset, the error will probably
    not recognized.

    Thanks for attention,
    Achim

    achim schrieb:
    > Hi,
    >
    > using a new location: no success
    >
    > export and import as shape-file: no success
    >
    > reproduce it with spearfish dataset: no success
    >
    > Has anybody an idea?
    >
    > I attach the problem-polygon as a shape... hope somebody has the same
    > problem with it ...and an idea.
    >
    > Thanks,
    > Achim
    >
    > achim schrieb:
    >> Hello,
    >>
    >> I used v.to.rast
    >> v.to.rast --overwrite input=inmap output=outmap use=cat
    >> to convert 29 areas to raster.
    >>
    >> It says
    >> Converted areas: 29 of 29
    >> but one area is missing!!!
    >>
    >> Its the one with cat number 16. Doing the same just for the
    selected 16,
    >> conversion results in am empty raster map.
    >>
    >> the same with use=attr or usr=val. Another vector map also does not
    >> convert some areas. The missing areas are not special
    >>
    >> What happens? Magic?
    >>
    >> I tried it with grass64 and newly compiled grass65. (OpenSuse
    11.1 64bit)
    >>
    >> Achim
    >>
    >> PS:
    >> Layer: 1
    >> Typ Anzahl Min Max
    >> Punkt 0 0 0
    >> Linie 0 0 0
    >> Grenze 0 0 0
    >> Zentroid 29 1 29
    >> Fläche 0 0 0
    >> Alle 29 1 29
    >> _______________________________________________
    >> grass-user mailing list
    >> grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    >> http://lists.osgeo.org/mailman/listinfo/grass-user
    >>
    >>
    ------------------------------------------------------------------------
    >>
    >> _______________________________________________
    >> grass-user mailing list
    >> grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    >> http://lists.osgeo.org/mailman/listinfo/grass-user
    _______________________________________________
    grass-user mailing list
    grass-user@lists.osgeo.org <mailto:grass-user@lists.osgeo.org>
    http://lists.osgeo.org/mailman/listinfo/grass-user

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user