Skip to content
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

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

Closed
agila5 opened this issue May 20, 2021 · 5 comments
Closed

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

agila5 opened this issue May 20, 2021 · 5 comments
Labels
feature 🎁 Request a new feature

Comments

@agila5
Copy link
Collaborator

agila5 commented May 20, 2021

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 😅

@agila5 agila5 added the feature 🎁 Request a new feature label May 20, 2021
@luukvdmeer
Copy link
Owner

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

agila5 added a commit that referenced this issue Aug 30, 2021
@agila5
Copy link
Collaborator Author

agila5 commented Aug 30, 2021

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
Copy link
Owner

This is fixed now thanks to @agila5

@agila5
Copy link
Collaborator Author

agila5 commented Nov 26, 2021

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
Copy link
Owner

Agree 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎁 Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants