Examples for 'maptools::readShapeLines'


Read arc shape files into SpatialLinesDataFrame objects

Aliases: readShapeLines writeLinesShape

Keywords: spatial

### ** Examples

xx <- readShapeLines(system.file("shapes/fylk-val.shp", package="maptools")[1],
 proj4string=CRS("+proj=utm +zone=33 +datum=WGS84"))
Warning: readShapeLines is deprecated; use rgdal::readOGR or sf::st_read
plot(xx, col="blue")
summary(xx)
Object of class SpatialLinesDataFrame
Coordinates:
          min     max
x   -4867.832 1084722
y 6456207.000 7841997
Is projected: TRUE 
proj4string : [+proj=utm +zone=33 +datum=WGS84]
Data attributes:
     FNODE_           TNODE_           LPOLY_         RPOLY_    
 Min.   :  1.00   Min.   :  2.00   Min.   :1.00   Min.   :1.00  
 1st Qu.: 40.00   1st Qu.: 39.00   1st Qu.:2.00   1st Qu.:2.00  
 Median : 74.00   Median : 77.00   Median :2.00   Median :2.00  
 Mean   : 77.62   Mean   : 77.55   Mean   :1.99   Mean   :1.99  
 3rd Qu.:115.00   3rd Qu.:114.00   3rd Qu.:2.00   3rd Qu.:2.00  
 Max.   :160.00   Max.   :159.00   Max.   :2.00   Max.   :2.00  
     LENGTH            VALINJE_    VALINJE_ID         LTEMA          VANNBR  
 Min.   :   106.4   Min.   : 1   Min.   : 55.00   Min.   :3211   Min.   :13  
 1st Qu.: 11866.5   1st Qu.:25   1st Qu.: 74.00   1st Qu.:3211   1st Qu.:13  
 Median : 31910.9   Median :49   Median : 95.00   Median :3211   Median :13  
 Mean   : 41374.7   Mean   :49   Mean   : 94.32   Mean   :3211   Mean   :13  
 3rd Qu.: 59311.8   3rd Qu.:73   3rd Qu.:114.00   3rd Qu.:3211   3rd Qu.:13  
 Max.   :176540.1   Max.   :97   Max.   :135.00   Max.   :3211   Max.   :13  
      DATO         
 Min.   :19970630  
 1st Qu.:19970630  
 Median :19970630  
 Mean   :19970630  
 3rd Qu.:19970630  
 Max.   :19970630  
xxx <- xx[xx$LENGTH > 30000,]
plot(xxx, col="red", add=TRUE)
plot of chunk example-maptools-readShapeLines-1
tmpfl <- paste(tempdir(), "xxline", sep="/")
writeLinesShape(xxx, tmpfl)
Warning: writeLinesShape is deprecated; use rgdal::writeOGR or sf::st_write
getinfo.shape(paste(tmpfl, ".shp", sep=""))
Shapefile type: PolyLine, (3), # of Shapes: 51
axx <- readShapeLines(tmpfl, proj4string=CRS("+proj=utm +zone=33 +datum=WGS84"))
Warning: readShapeLines is deprecated; use rgdal::readOGR or sf::st_read
plot(xxx, col="black", lwd=4)
plot(axx, col="yellow", lwd=1, add=TRUE)
plot of chunk example-maptools-readShapeLines-1
unlink(paste(tmpfl, ".*", sep=""))
xx <- readShapeLines(system.file("shapes/sids.shp", package="maptools")[1],
 proj4string=CRS("+proj=longlat +datum=NAD27"))
Warning: readShapeLines is deprecated; use rgdal::readOGR or sf::st_read
plot(xx, col="blue")
plot of chunk example-maptools-readShapeLines-1

[Package maptools version 1.1-4 Index]