Set of multilinestrings won't convert into sfnetwork #143
Answered
by
idshklein
andtheWings
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Did you try st_cast(spatial_df, "LINESTRING")?
…On Fri, Mar 19, 2021, 03:13 Daniel Riggins ***@***.***> wrote:
I'm trying to make a sfnetwork object from a map of all streets in
Indianapolis, but getting the following error:
library(sf)#> Linking to GEOS 3.8.1, GDAL 3.1.3, PROJ 7.1.0
library(sfnetworks)
Indy_Streets <- st_read("https://opendata.arcgis.com/datasets/fa9ec663cf25407a9b7645ff14334a7f_13.geojson")#> Reading layer `Street_Centerlines' from data source `https://opendata.arcgis.com/datasets/fa9ec663cf25407a9b7645ff14334a7f_13.geojson' using driver `GeoJSON'#> Simple feature collection with 69472 features and 53 fields#> geometry type: MULTILINESTRING#> dimension: XY#> bbox: xmin: -86.35518 ymin: 39.62654 xmax: -85.93584 ymax: 39.94967#> geographic CRS: WGS 84
Indy_Streets$geometry#> Geometry set for 69472 features #> geometry type: MULTILINESTRING#> dimension: XY#> bbox: xmin: -86.35518 ymin: 39.62654 xmax: -85.93584 ymax: 39.94967#> geographic CRS: WGS 84#> First 5 geometries:#> MULTILINESTRING ((-86.15981 39.8649, -86.15984 ...#> MULTILINESTRING ((-86.2729 39.6738, -86.27343 3...#> MULTILINESTRING ((-86.14312 39.9057, -86.14224 ...#> MULTILINESTRING ((-86.05485 39.9097, -86.05484 ...#> MULTILINESTRING ((-86.2158 39.7859, -86.21582 3...
Indy_Streets.sfnetwork <- as_sfnetwork(Indy_Streets)#> Error: Geometries are not all of type LINESTRING, or all of type POINT
Created on 2021-03-18 by the reprex package <https://reprex.tidyverse.org>
(v1.0.0)
So it seems clear the issue is that each geometry is a multilinestring and
not a linestring, but is there some processing I can do to solve this?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#143>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC5Q36WYUEQ7JAN5NYRB2JLTEKQK7ANCNFSM4ZNZ7PYQ>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
andtheWings
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to make a sfnetwork object from a map of all streets in Indianapolis, but getting the following error:
Created on 2021-03-18 by the reprex package (v1.0.0)
So it seems clear the issue is that each geometry is a multilinestring and not a linestring, but is there some processing I can do to solve this?
Beta Was this translation helpful? Give feedback.
All reactions