Skip to content
Back to formatted view

Raw Message

Message-ID: <CANVKczNy+9WCDveZwxhPF2ybug1mySeVxdj192tv5Sga9jo4eg@mail.gmail.com>
Date: 2011-09-16T16:59:32Z
From: Barry Rowlingson
Subject: [raster] a railroad, a raster with a different value on each side of it
In-Reply-To: <CANVKczPmTriOTGEcwsgtiBPN2_jun_yr6-6wUagR=GyK5_k5Gg@mail.gmail.com>

On Fri, Sep 16, 2011 at 4:51 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
> If your railroad is just a single line feature running approx N-S then:
>
> ?Create a box polygon for your study area, make sure the railroad just
> crosses it at N and S edges
>
> ?Use rgeos functions overlaying the RR line with the box polygon to
> create the E and W polygons

 Actually you dont even need rgeos...

 If your RR goes from the S edge of a rectangular study region to the
N edge, and is a single line, then your W and E polygons are then:

bottom left corner, intersection point of RR with S edge, RR points,
intersection point of RR with N edge, top left corner

bottom right corner, intersection point of RR with S edge, RR points,
intersection point of RR with N edge, top right corner

 - in other words you just trace along the bounding rectangle and the
RR. Get the RR coords from the SpatialLines* object and you're pretty
much set to make polygons out of it. Once you have the polygons you
can overlay them on rasters. Should be pretty quick.

Barry