4.4 Import GeoJSON file
This GeoJSON dataset contains watercourses (stream, river) and main ditches of
the Montreal agglomeration (available here). Hence, it is a MULTILINE
object.
# Download shapefile from web page in your working directory
if (!file.exists("data/courseau.geojson")) {
download.file("https://data.montreal.ca/dataset/c128aff5-325c-4599-ab66-1c9d0b3abc94/resource/0f64976e-19c1-4d29-bcc5-4b663a392617/download/courseau.geojson", destfile = "data/courseau.geojson")
}
# For GeoJSON, dsn may be the character string holding the geojson data
courseau <- st_read(dsn = "data/courseau.geojson")
#R> Reading layer `courseau' from data source
#R> `/home/runner/work/rInSpace/rInSpace/data/courseau.geojson'
#R> using driver `GeoJSON'
#R> Simple feature collection with 1306 features and 5 fields
#R> Geometry type: MULTILINESTRING
#R> Dimension: XY
#R> Bounding box: xmin: -73.97268 ymin: 45.41593 xmax: -73.4975 ymax: 45.69939
#R> Geodetic CRS: WGS 84
#R> Simple feature collection with 6 features and 5 fields
#R> Geometry type: MULTILINESTRING
#R> Dimension: XY
#R> Bounding box: xmin: -73.9206 ymin: 45.42815 xmax: -73.9066 ymax: 45.47614
#R> Geodetic CRS: WGS 84
#R> OBJECTID_1 NOM TYPE Shape_Le_1 NuméroRui
#R> 1 1 rivière à l'Orme rivière 177.95299 <NA>
#R> 2 2 rivière à l'Orme rivière 128.51146 <NA>
#R> 3 3 <NA> fossé 172.42988 <NA>
#R> 4 4 rivière à l'Orme rivière 216.66838 <NA>
#R> 5 8 <NA> fossé 540.29539 <NA>
#R> 6 9 <NA> ruisseau 97.66412 <NA>
#R> geometry
#R> 1 MULTILINESTRING ((-73.9107 ...
#R> 2 MULTILINESTRING ((-73.90824...
#R> 3 MULTILINESTRING ((-73.90667...
#R> 4 MULTILINESTRING ((-73.91472...
#R> 5 MULTILINESTRING ((-73.91029...
#R> 6 MULTILINESTRING ((-73.9206 ...