luukvdmeer / sfnetworks

Tidy Geospatial Networks in R
https://luukvdmeer.github.io/sfnetworks/
Other
338 stars 20 forks source link

Adjust the number of features printed by print.sfnetwork #157

Closed agila5 closed 2 years ago

agila5 commented 3 years ago

Is your feature request related to a problem? Please describe. I'm always frustrated when the printing of an sfnetwork object stops after a few rows (and the problematic rows remain hidden).

Describe the solution you'd like I would like to implement an option or an extra parameter to decide how many features should be printed for the active and inactive geometries. I think that, at the moment, we hardcoded the values 6 and 3, respectively. I'm not saying we should modify the default values, just make them modifiable.

Describe alternatives you've considered Not sure 😅

luukvdmeer commented 3 years ago

Makes sense to me! This should not be too hard right @loreabad6 ?

agila5 commented 3 years ago

After that commit:

library(sfnetworks)

Default:

as_sfnetwork(roxel)
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # Node Data:     701 x 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>              geometry
#>           <POINT [°]>
#> 1 (7.533722 51.95556)
#> 2 (7.533461 51.95576)
#> 3 (7.532442 51.95422)
#> 4  (7.53209 51.95328)
#> 5 (7.532709 51.95209)
#> 6 (7.532869 51.95257)
#> # ... with 695 more rows
#> #
#> # Edge Data:     851 x 5
#> # Geometry type: LINESTRING
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>    from    to name                  type                                geometry
#>   <int> <int> <chr>                 <fct>                       <LINESTRING [°]>
#> 1     1     2 Havixbecker Strasse   residential (7.533722 51.95556, 7.533461 51~
#> 2     3     4 Pienersallee          secondary   (7.532442 51.95422, 7.53236 51.~
#> 3     5     6 Schulte-Bernd-Strasse residential (7.532709 51.95209, 7.532823 51~
#> # ... with 848 more rows

Change options

options(sfn_max_print_active = 1L, sfn_max_print_inactive = 2L)
as_sfnetwork(roxel)
#> # A sfnetwork with 701 nodes and 851 edges
#> #
#> # CRS:  EPSG:4326 
#> #
#> # A directed multigraph with 14 components with spatially explicit edges
#> #
#> # Node Data:     701 x 1 (active)
#> # Geometry type: POINT
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522622 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>              geometry
#>           <POINT [°]>
#> 1 (7.533722 51.95556)
#> # ... with 700 more rows
#> #
#> # Edge Data:     851 x 5
#> # Geometry type: LINESTRING
#> # Dimension:     XY
#> # Bounding box:  xmin: 7.522594 ymin: 51.94151 xmax: 7.546705 ymax: 51.9612
#>    from    to name                type                                  geometry
#>   <int> <int> <chr>               <fct>                         <LINESTRING [°]>
#> 1     1     2 Havixbecker Strasse residential (7.533722 51.95556, 7.533461 51.9~
#> 2     3     4 Pienersallee        secondary   (7.532442 51.95422, 7.53236 51.95~
#> # ... with 849 more rows

Created on 2021-08-30 by the reprex package (v2.0.1)

Not sure how to document the new params since there is no Rd file for print.sfnetwork. Moreover, feel free to change the name of the new parameters.

luukvdmeer commented 2 years ago

This is fixed now thanks to @agila5

agila5 commented 2 years ago

Hi! Quick question: what do you think about including a new example in ?sfnetwork to present these new parameters? I keep forgetting their names and, AFAIK, they are not documented anywhere but in the news file and in the code. If you agree, I can add a PR.

luukvdmeer commented 2 years ago

Agree :+1: