[GRASS-user] filling inter-contour area with constant value

Huidae Cho grass4u at gmail.com
Wed Apr 30 11:50:42 PDT 2014


Venka,

Let's say you have the elevation field in your shapefile and the contour
interval is 2 meters.

# Import your shapefile into GRASS
v.in.ogr dsn=contours.shp output=contours type=boundary

# Add centroids to the imported boundaries to make areas
v.centroids input=contours output=contourareas

# Convert the contour areas to raster filling inter-contour areas with
contour elevations
v.to.rast input=contourareas output=contourareas use=attr
attrcolumn=elevation

# Now you want to add a half of the contour interval to get what you want
r.mapcalc expression="contoursteps=contourareas+1"

contoursteps is what you need, I think.

Regards,
Huidae



On Tue, Apr 29, 2014 at 4:19 AM, Moritz Lennert <
mlennert at club.worldonline.be> wrote:

> [Please keep threads on the list]
>
> On 29/04/14 00:33, John Ciolek wrote:
>
>> Hi Moritz.
>>
>> What do you mean by the following suggestion?
>>
>>
>> On Apr 28, 2014, at 2:45 AM, Moritz Lennert wrote:
>>
>>  - if necessary, add a line at the edge of the region and patch that
>>> with your contour lines to close polygons (v.in.region, v.patch)
>>>
>>
>> Are you suggesting that you can close a contour (connect the beginning
>> point to the ending point) using v.in.region or v.patch?
>>
>
> No, not the beginning point to the end point. Either you have closed
> contours or your contours go over the edge of your current region, meaning
> that some contours are not closed. So, in order to close them, you can do
> so arbitrarily at the edge of your region by patching in a line that
> represents that edge. This line can be created with v.in.region.
>
>
> Moritz
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140430/e5633585/attachment.html>


More information about the grass-user mailing list