[R-sig-Geo] Create Nodes at lines' segments extremities.
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Fri Mar 3 15:09:39 CET 2017
(after receiving the data, off-list):
library(sp)
library(rgdal)
x = readOGR("TRONCON_TOPO_Bresle.shp")
lapply(x at lines, function(y) lapply(y at Lines, function(z) apply(z at coords,
2, range)))
gives you the bounding box of each individual Line element, as a nested
list (similar to how x at lines is nested).
On 02/03/17 17:53, Tristan Bourgeois wrote:
> Hi everybody,
>
> I can't find any infomation about the gis manipulation I want to process on
> R. Even if there are similar posts on r-sig-geo archives...
>
>
> My issue is the following one :
>
>> *myline<-readOGR(dsn = "./shapes/shp_tr_topo",layer =
> "TRONCON_TOPO_Bresle" ) is a spatial polyline which is composed of :*
>
>> *length(line at lines)*
> [1] 585 => 585 segments
>
>
> It seems that each of those 585 lines are acually a serie of points :
>
> *> line at lines[[1]]@Lines*
> [[1]]
> An object of class "Line"
> Slot "coords":
> [,1] [,2]
> [1,] 609046.7 6956543
> [2,] 609057.3 6956543
> [3,] 609077.6 6956546
> [4,] 609103.2 6956553
> [5,] 609132.5 6956561
> [6,] 609146.0 6956568
> [7,] 609157.4 6956574
> [8,] 609167.0 6956577
> [9,] 609176.9 6956581
> [10,] 609184.4 6956585
> [11,] 609191.9 6956588
> [12,] 609199.3 6956591
> [13,] 609205.7 6956594
> [14,] 609212.6 6956599
> [15,] 609216.6 6956604
> [16,] 609222.6 6956609
> [17,] 609229.0 6956613
> [18,] 609237.9 6956619
> [19,] 609244.4 6956623
> [20,] 609253.5 6956626
> [21,] 609265.2 6956631
> [22,] 609276.5 6956636
> [23,] 609287.4 6956639
> [24,] 609296.9 6956644
> [25,] 609305.1 6956647
> [26,] 609308.6 6956653
>
> What I want to obtain are the coordinates of each segments extremities. So
> for a segment I should have 2 points with X,Y values.
> I tried to apply the rgeos Gnode function but nothing appears as changed.
> Maybe there's something to do with the min and max X,Y of each segments ?
>
>
> Does somebody has already done /wrote a similar script to process that ??
>
>
> Thank you in advance for the helpfull advices.
>
> Cheers.
>
> Tristan Bourgeois
> Hydromorphologist Engineer
> Seine Normandie Water Agency
> Rouen, France
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software: http://www.jstatsoft.org/
Computers & Geosciences: http://elsevier.com/locate/cageo/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170303/c7e92b81/attachment.bin>
More information about the R-sig-Geo
mailing list