-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-generate spatial objects to prevent warnings #393
Comments
summary()
of SpatialLinesNetwork
objectsSpatialLinesNetwork
objects
Confirmed. I can reproduce this. |
Definitely should be fixed. Simple work-around demonstrated below FYI: library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 7.0.0
library(stplanr)
st_crs(route_network_sf)
#> Coordinate Reference System:
#> User input: EPSG:4326
#> wkt:
#> GEOGCRS["WGS 84",
#> DATUM["World Geodetic System 1984",
#> ELLIPSOID["WGS 84",6378137,298.257223563,
#> LENGTHUNIT["metre",1]]],
#> PRIMEM["Greenwich",0,
#> ANGLEUNIT["degree",0.0174532925199433]],
#> CS[ellipsoidal,2],
#> AXIS["geodetic latitude (Lat)",north,
#> ORDER[1],
#> ANGLEUNIT["degree",0.0174532925199433]],
#> AXIS["geodetic longitude (Lon)",east,
#> ORDER[2],
#> ANGLEUNIT["degree",0.0174532925199433]],
#> USAGE[
#> SCOPE["unknown"],
#> AREA["World"],
#> BBOX[-90,-180,90,180]],
#> ID["EPSG",4326]]
st_crs(route_network_sf) = NA
sln <- SpatialLinesNetwork(route_network_sf)
st_crs(sln@sl) = 4326
summary(sln)
#> Weight attribute field: lengthIGRAPH 6b05630 U-W- 52 80 --
#> + attr: x (g/n), y (g/n), n (g/n), weight (e/n)
#> All geometry length
#> Min. :0 LINESTRING :80 Min. :0.0001547
#> 1st Qu.:0 epsg:4326 : 0 1st Qu.:0.0012721
#> Median :0 +proj=long...: 0 Median :0.0024601
#> Mean :0 Mean :0.0042530
#> 3rd Qu.:0 3rd Qu.:0.0046131
#> Max. :0 Max. :0.0299576 Created on 2020-04-29 by the reprex package (v0.3.0) |
Aaaaah, so it's just a problem of the |
I'm not sure. I think there may still be an issue with the function. May well be worth updating the objects, also applies to the old |
I think that the summary function should be fine since it's simply a wrapper around sf:::summary.sfc and the "true" warning is there: # packages
library(sf)
#> Linking to GEOS 3.6.1, GDAL 2.2.3, PROJ 4.9.3
library(stplanr)
attributes(st_geometry(route_network_sf)) # warning
#> $class
#> [1] "sfc_LINESTRING" "sfc"
#>
#> $precision
#> [1] 0
#>
#> $bbox
#> xmin ymin xmax ymax
#> -1.550964 53.802478 -1.510987 53.830414
#>
#> $crs
#> Coordinate Reference System:
#> Warning in `$.crs`(x, "input"): CRS uses proj4string, which is deprecated.
#> Warning in `$.crs`(x, "input"): CRS uses proj4string, which is deprecated.
#> User input: +proj=longlat +datum=WGS84 +no_defs
#> Warning in `$.crs`(x, "wkt"): CRS uses proj4string, which is deprecated.
#> Warning in `$.crs`(x, "wkt"): CRS uses proj4string, which is deprecated.
#> wkt:
#> GEOGCS["WGS 84",
#> DATUM["WGS_1984",
#> SPHEROID["WGS 84",6378137,298.257223563,
#> AUTHORITY["EPSG","7030"]],
#> AUTHORITY["EPSG","6326"]],
#> PRIMEM["Greenwich",0,
#> AUTHORITY["EPSG","8901"]],
#> UNIT["degree",0.0174532925199433,
#> AUTHORITY["EPSG","9122"]],
#> AUTHORITY["EPSG","4326"]]
#>
#> $n_empty
#> [1] 0
sln <- SpatialLinesNetwork(route_network_sf)
summary(sln)
#> Weight attribute field: lengthIGRAPH 3bccff9 U-W- 52 80 --
#> + attr: x (g/n), y (g/n), n (g/n), weight (e/n)
#> Warning in `$.crs`(attr(object, "crs"), "proj4string"): CRS uses proj4string,
#> which is deprecated.
#> All geometry length
#> Min. :0 LINESTRING :80 Min. : 13.44
#> 1st Qu.:0 epsg:4326 : 0 1st Qu.: 114.49
#> Median :0 +proj=long...: 0 Median : 205.68
#> Mean :0 Mean : 353.03
#> 3rd Qu.:0 3rd Qu.: 373.74
#> Max. :0 Max. :2660.27
# "fix" the CRS stuff
st_crs(route_network_sf) <- 4326
attributes(st_geometry(route_network_sf))
#> $class
#> [1] "sfc_LINESTRING" "sfc"
#>
#> $precision
#> [1] 0
#>
#> $bbox
#> xmin ymin xmax ymax
#> -1.550964 53.802478 -1.510987 53.830414
#>
#> $crs
#> Coordinate Reference System:
#> User input: EPSG:4326
#> wkt:
#> GEOGCS["WGS 84",
#> DATUM["WGS_1984",
#> SPHEROID["WGS 84",6378137,298.257223563,
#> AUTHORITY["EPSG","7030"]],
#> AUTHORITY["EPSG","6326"]],
#> PRIMEM["Greenwich",0,
#> AUTHORITY["EPSG","8901"]],
#> UNIT["degree",0.0174532925199433,
#> AUTHORITY["EPSG","9122"]],
#> AUTHORITY["EPSG","4326"]]
#>
#> $n_empty
#> [1] 0
sln <- SpatialLinesNetwork(route_network_sf)
summary(sln)
#> Weight attribute field: lengthIGRAPH 3bd7cdb U-W- 52 80 --
#> + attr: x (g/n), y (g/n), n (g/n), weight (e/n)
#> All geometry length
#> Min. :0 LINESTRING :80 Min. : 13.44
#> 1st Qu.:0 epsg:4326 : 0 1st Qu.: 114.49
#> Median :0 +proj=long...: 0 Median : 205.68
#> Mean :0 Mean : 353.03
#> 3rd Qu.:0 3rd Qu.: 373.74
#> Max. :0 Max. :2660.27 Created on 2020-04-29 by the reprex package (v0.3.0) Though, I have no idea of the consequences of this modification on the other stplanr examples. |
We can make that change no problem, we had to do similar things in the |
SpatialLinesNetwork
objects
Created on 2020-04-29 by the reprex package (v0.3.0)
Session info
The text was updated successfully, but these errors were encountered: