Skip to content

[raster] a railroad, a raster with a different value on each side of it

6 messages · Mathieu Rajerison, Barry Rowlingson, Jacob van Etten +1 more

#
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

 Job done?

On Fri, Sep 16, 2011 at 1:11 PM, Mathieu Rajerison
<mathieu.rajerison at gmail.com> wrote:

  
    
  
#
On Fri, Sep 16, 2011 at 4:51 PM, Barry Rowlingson
<b.rowlingson at lancaster.ac.uk> wrote:
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
1 day later
1 day later