GDAL
May 5, 2010, 4:58pm
1
#1057: r.slope.aspect: add -c option
-------------------------+--------------------------------------------------
Reporter: paoloC | Owner: grass-dev@lists.osgeo.org
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: unspecified
Keywords: | Platform: Unspecified
Cpu: Unspecified |
-------------------------+--------------------------------------------------
Is it possible to add a '-c' option to r.slope.aspect in order to get an
aspect raster map with compass notation (North=360, East=90, South=180,
West=270) ?
e.g.:
{{{
r.mapcalc "aspect_compass=if(isnull(aspect_from_east),null(), \
if((aspect_from_east<90), 90-aspect_from_east, 360+90-
aspect_from_east))"
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1057> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
May 5, 2010, 4:59pm
2
#1057: r.slope.aspect: add -c option
--------------------------+-------------------------------------------------
Reporter: paoloC | Owner: grass-dev@lists.osgeo.org
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.slope.aspect
Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by martinl):
* keywords: => r.slope.aspect
* version: unspecified => svn-trunk
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1057#comment:1> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
May 6, 2010, 9:08am
3
#1057: r.slope.aspect: add -c option
--------------------------+-------------------------------------------------
Reporter: paoloC | Owner: grass-dev@lists.osgeo.org
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.slope.aspect
Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by hamish):
it's pretty easy to do this by hand:
{{{
r.mapcalc "compass_aspect = 90 - theta_aspect"
}}}
and maybe a `if(aspect < 0) {aspect = aspect + 360 }` step after.
Hamish
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1057#comment:2> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
May 6, 2010, 4:25pm
4
#1057: r.slope.aspect: add -c option
--------------------------+-------------------------------------------------
Reporter: paoloC | Owner: grass-dev@lists.osgeo.org
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.slope.aspect
Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by glynn):
Replying to [ticket:1057 paoloC]:
> Is it possible to add a '-c' option to r.slope.aspect in order to get an
aspect raster map with compass notation (North=360, East=90, South=180,
West=270) ?
>
> e.g.:
>
{{{
r.mapcalc "aspect_compass=if(isnull(aspect_from_east),null(), \
if((aspect_from_east<90), 90-aspect_from_east, 360+90-
aspect_from_east))"
}}}
Simpler version:
{{{
r.mapcalc "aspect_compass = (450 - aspect_from_east) % 360"
}}}
There's no need for an explicit null check, as almost any operation
involving null returns null.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1057#comment:3> ;
GRASS GIS <http://grass.osgeo.org >
GDAL
September 11, 2012, 12:04am
5
#1057: r.slope.aspect: add -c option
----------------------------+-----------------------------------------------
Reporter: paoloC | Owner: grass-dev@…
Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Raster | Version: svn-trunk
Keywords: r.slope.aspect | Platform: Unspecified
Cpu: Unspecified |
----------------------------+-----------------------------------------------
Comment(by hamish):
see code in addons/grass6/display/d.barb/main.c
{{{
type_opt = G_define_option();
type_opt->key = "aspect_type";
type_opt->type = TYPE_STRING;
type_opt->required = NO;
type_opt->answer = "cartesian";
type_opt->options = "cartesian,compass";
type_opt->description = _("Direction map aspect type");
}}}
{{{
/* aspect flavours */
#define TYPE_GRASS 0
#define TYPE_COMPASS 1
...
if (strcmp(type_opt->answer, "compass") == 0)
aspect_type = TYPE_COMPASS;
else
aspect_type = TYPE_GRASS;
...
angle = (aspect_type == TYPE_GRASS ? theta : 90 - theta);
}}}
Hamish
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1057#comment:4> ;
GRASS GIS <http://grass.osgeo.org >