[GRASS-user] Euclidean distance (grow.distance) on raster to certain extent?

Hello,

I am trying to run the grow.distance command to create a raster that displays the euclidean distance from an ‘orchard’ outward to 1108m. I am not trying to measure the distance between 2 non-null features, but simply wish to have the euclidean distance extend out from the orchard to 1108m. I recognize this tool does not allow a distance to be included so I created a buffer around my orchard (1108m) and intended to run grow.distance on that, however it outputs the distance as if it includes the full raster extent (so I have an output raster of 1108m that is all yellow as opposed to a range of values displaying varying distances) and not limited to my buffer. I want it to assume the buffer extent is the raster extent, so to speak. Is there another way to do this?
Any ideas would be much appreciated.

Best,

Tanya

Tanya wrote:

I am trying to run the grow.distance command to create a raster that displays the euclidean distance from an ‘orchard’ outward to 1108m. I am not trying to measure the distance between 2 non-null features, but simply wish to have the euclidean distance extend out from the orchard to 1108m.

I don´t know r.grow.distance or why it is not working for you, but every time I need distance rasters, I use the procedure found in the GRASS book, as follows:

r.mapcalc area1=1

r.cost -k in=area1 out=distance_to_orchard start_rast=orchard_location --o --q
r.mapcalc “distance_to_orchard=distance_to_orchard * (ewres() + nsres())/2.”

It is an approximate measure, but you can evolve this idea for a better solution for your case. Then you only need to use your buffer as a mask to get the final raster you want or simply use:

r.mapcalc “final_raster=if(distance_to_orchard<=1108,distance_to_orchard,null())”

Hope it helps.
Cheers,
Marcello.

Hi Tanya,

I would use r.distance rather than r.grow.distance and then reclassify the results to include only areas with <=1108 m distance - that should be a lot easier.

Best,
Daniel

B.Sc. Daniel Lee
Geschäftsführung für Forschung und Entwicklung
ISIS - International Solar Information Solutions GbR
Vertreten durch: Daniel Lee, Nepomuk Reinhard und Nils Räder

Softwarecenter 3
35037 Marburg
Festnetz: +49 6421 379 6256
Mobil: +49 176 6127 7269
E-Mail: Lee@isi-solutions.org
Web: http://www.isi-solutions.org

2012/5/7 Tanya Dyck <tanya.dyck@hotmail.com>

Hello,

I am trying to run the grow.distance command to create a raster that displays the euclidean distance from an ‘orchard’ outward to 1108m. I am not trying to measure the distance between 2 non-null features, but simply wish to have the euclidean distance extend out from the orchard to 1108m. I recognize this tool does not allow a distance to be included so I created a buffer around my orchard (1108m) and intended to run grow.distance on that, however it outputs the distance as if it includes the full raster extent (so I have an output raster of 1108m that is all yellow as opposed to a range of values displaying varying distances) and not limited to my buffer. I want it to assume the buffer extent is the raster extent, so to speak. Is there another way to do this?
Any ideas would be much appreciated.

Best,

Tanya


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

On 07/05/12 16:36, Daniel Lee wrote:

Hi Tanya,

I would use r.distance rather than r.grow.distance and then reclassify
the results to include only areas with <=1108 m distance - that should
be a lot easier.

I don't think r.distance gives what you want, however r.grow.distance should be exactly your tool:

As a starting point you need a raster map with all pixels in the orchard non-null and all other pixels null Let's call that raster map 'orchard'. Then you can do the following:

r.grow.distance input=orchard distance=distance_map

Then, if you only want to see the distance from the orchard to 1108m, then you can use r.mapcalc:

r.mapcalc "final_distance_map=if(distance_map>1108, null(), distance_map)"

All this keeping in mind that I don't understand what you mean by "I recognize this tool does not allow a distance to be included".

If this means that you also want to measure a distance _within_ the orchard, then instead of using a raster map of the orchard, use as input to r.grow.distance a raster map with only the center pixel of the orchard non-null.

Moritz

2012/5/7 Tanya Dyck <tanya.dyck@hotmail.com <mailto:tanya.dyck@hotmail.com>>

    Hello,

    I am trying to run the grow.distance command to create a raster that
    displays the euclidean distance from an 'orchard' outward to 1108m.
      I am not trying to measure the distance between 2 non-null
    features, but simply wish to have the euclidean distance extend out
    from the orchard to 1108m. I recognize this tool does not allow a
    distance to be included so I created a buffer around my orchard
    (1108m) and intended to run grow.distance on that, however it
    outputs the distance as if it includes the full raster extent (so I
    have an output raster of 1108m that is all yellow as opposed to a
    range of values displaying varying distances) and not limited to my
    buffer. I want it to assume the buffer extent is the raster extent,
    so to speak. Is there another way to do this?
    Any ideas would be much appreciated.

    Best,

    Tanya

    _______________________________________________
    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

Thank you Moritz, this worked beautifully!

Date: Mon, 7 May 2012 18:00:01 +0200
From: mlennert@club.worldonline.be
To: lee@isi-solutions.org
CC: tanya.dyck@hotmail.com; grass-user@lists.osgeo.org
Subject: Re: [GRASS-user] Euclidean distance (grow.distance) on raster to certain extent?

On 07/05/12 16:36, Daniel Lee wrote:

Hi Tanya,

I would use r.distance rather than r.grow.distance and then reclassify
the results to include only areas with <=1108 m distance - that should
be a lot easier.

I don’t think r.distance gives what you want, however r.grow.distance
should be exactly your tool:

As a starting point you need a raster map with all pixels in the orchard
non-null and all other pixels null Let’s call that raster map
‘orchard’. Then you can do the following:

r.grow.distance input=orchard distance=distance_map

Then, if you only want to see the distance from the orchard to 1108m,
then you can use r.mapcalc:

r.mapcalc “final_distance_map=if(distance_map>1108, null(), distance_map)”

All this keeping in mind that I don’t understand what you mean by “I
recognize this tool does not allow a distance to be included”.

If this means that you also want to measure a distance within the
orchard, then instead of using a raster map of the orchard, use as input
to r.grow.distance a raster map with only the center pixel of the
orchard non-null.

Moritz

2012/5/7 Tanya Dyck <tanya.dyck@hotmail.com mailto:tanya.dyck@hotmail.com>

Hello,

I am trying to run the grow.distance command to create a raster that
displays the euclidean distance from an ‘orchard’ outward to 1108m.
I am not trying to measure the distance between 2 non-null
features, but simply wish to have the euclidean distance extend out
from the orchard to 1108m. I recognize this tool does not allow a
distance to be included so I created a buffer around my orchard
(1108m) and intended to run grow.distance on that, however it
outputs the distance as if it includes the full raster extent (so I
have an output raster of 1108m that is all yellow as opposed to a
range of values displaying varying distances) and not limited to my
buffer. I want it to assume the buffer extent is the raster extent,
so to speak. Is there another way to do this?
Any ideas would be much appreciated.

Best,

Tanya


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