Road slope from DGPS sites [vectors]
Angus Carr
apcarr at FLASH.LakeheadU.CA
Mon Feb 1 08:33:38 EST 1999
Out of curiosity, what did you use to "spread the raster slightly"?
What I would do, personally, would be to run a series of r.mapcalc
commands, using mapcalc's ability to refer to cells by relative location.
In essence, this becomes a series of laplacian filters of this form:
0 1 0
0 0 0
0 0 0
0 0 0
0 0 1
0 0 0
0 0 0
0 0 0
0 1 0
0 0 0
1 0 0
0 0 0
repeated until the growth is sufficient.
so:
if mapA is the original with a single line which potentially has holes
(where you jumped 10 metres very quickly because of a bunch of horseflies,
presumably :-) , then this series of mapcalcs will do it...
tempA = mapA
#then loop through the following until you feel you are done...
tempB = if(tempA == 0,tempA[0][-1],tempA)
tempA = tempB
tempB = if(tempA == 0,tempA[1][0],tempA)
tempA = tempB
tempB = if(tempA == 0,tempA[0][1],tempA)
tempA = tempB
tempB = if(tempA == 0,tempA[-1][0],tempA)
tempA = tempB
This should be set up in a shell script.
I have used this for filling in holes in a classified satellite image that
has been clumped and seived to drop polygons that are too small to manage
for. It preserves any existing pixels while changing 0's to the nearest
known value. It tends to preserve shape. To remove some bias, you might
want to start the cycle of four at a random place, but make sure you do
all four directions every time. The overall effect is like a wound
scabbing in from the outside.
Anyway, good luck.
Angus.
On Mon, 1 Feb 1999, James Cameron wrote:
> G'day,
>
> I have data from my DGPS survey of a set of tracks on my farm, which
> includes a series of points with altitude (ASL) as I walked along the
> tracks. I want to prepare a colour map showing the tracks in colours
> according to the slope of the track in the direction of travel. The
> colours would change along a track.
>
> This is so that I can work out which bits of the track need work.
>
> I've moved the data into a sites file, with the ASL properly formatted
> such that I can use s.whatever.to.rast to convert to a raster. I've
> then been able to spread the raster slightly before using r.slope.aspect
> to generate a raster of the slope in degrees. But of course, as you
> move away from the track the numbers fall off ...
>
> So I think I've done it wrongly. How should it be done?
>
> What I get looks like this;
>
> 0 0 0 0 0 1 2 2 3 4 4 3 2 2 1 0 0 0 0 0
> 0 0 0 0 0 1 2 2 3 4 4 3 2 2 1 0 0 0 0 0
> 0 0 0 0 0 1 2 2 4 5 5 4 2 2 1 0 0 0 0 0
> 0 0 0 0 0 1 2 2 3 4 4 3 2 2 1 0 0 0 0 0
> 0 0 0 0 0 1 2 2 3 4 4 3 2 2 1 0 0 0 0 0
>
> What I want should look like this;
>
> 0 0 0 0 0 0 4 4 4 4 4 4 4 4 0 0 0 0 0 0
> 0 0 0 0 0 0 4 4 4 4 4 4 4 4 0 0 0 0 0 0
> 0 0 0 0 0 0 5 5 5 5 5 5 5 5 0 0 0 0 0 0
> 0 0 0 0 0 0 4 4 4 4 4 4 4 4 0 0 0 0 0 0
> 0 0 0 0 0 0 4 4 4 4 4 4 4 4 0 0 0 0 0 0
>
> Background information;
>
> - the DGPS data set was from a Trimble unit, with 95% within
> 30cm accuracy,
>
> - the raster cell size is 5m x 5m,
>
> - there are often multiple DGPS samples within a cell, because it
> was a reasonably hot day and I walked slowly with all that
> equipment on my back,
>
> - the resultant tracks drawn on a raster need to be enlarged to
> aid readability, I have not yet chosen the size, though I used
> eight cells in my example above.
>
> --
> James Cameron (cameron at stl.dec.com)
>
> OpenVMS, Linux, Firewalls, Software Engineering, CGI, HTTP, X, C, FORTH,
> COBOL, BASIC, DCL, csh, bash, ksh, sh, Electronics, Microcontrollers,
> Disability Engineering, Netrek, Bicycles, Pedant, Farming, Home Control,
> Remote Area Power, Greek Scholar, Tenor Vocalist, Church Sound, Husband.
>
> "Specialisation is for insects." -- Robert Heinlein.
>
More information about the grass-user
mailing list