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

Turn off regionalisation in overline() #510

Closed
joeytalbot opened this issue Dec 12, 2022 · 5 comments
Closed

Turn off regionalisation in overline() #510

joeytalbot opened this issue Dec 12, 2022 · 5 comments

Comments

@joeytalbot
Copy link

joeytalbot commented Dec 12, 2022

Using overline() on a large dataset, the function failed with the default method. But it worked for the same dataset when I turned off regionalisation:

> car_rnet = overline(
+   car_osrm,
+   attrib = "car_driver",
+   regionalise = 1e+07
+ )
2022-12-12 16:29:53 constructing segments
2022-12-12 16:29:59 building geometry
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s  
2022-12-12 16:30:02 simplifying geometry
2022-12-12 16:30:02 aggregating flows
2022-12-12 16:30:08 rejoining segments into linestrings
> car_rnet = overline(
+   car_osrm,
+   attrib = "car_driver"
+ )
2022-12-12 16:32:47 constructing segments
2022-12-12 16:32:54 building geometry
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=02s  
2022-12-12 16:32:56 simplifying geometry
large data detected, using regionalisation, nrow = 161011
Error in FUN(X[[i]], ...) : subscript out of bounds

It appears to make sense to have regionalisation turned off by default in overline(). Currently the only way to turn it off seems to be to provide a very high number, e.g. regionalise = 1e+07. There is no regionalise = FALSE option.

@Robinlovelace
Copy link
Member

Agreed. I think we should set the threshold to a high number as you suggest. Are you happy to give this a go Joey? Thanks for reporting, will save lots of people lots of time I think.

@joeytalbot
Copy link
Author

Yes, I'll have a go!

@joeytalbot
Copy link
Author

Ok, this issue already seems to be fixed! I was using v1.0.1 of stplanr. In v1.0.2, the latest version, regionalise is set to 1e+09 by default. I should have updated the package :)

@Robinlovelace
Copy link
Member

Aha, well spotted. Always worth checking package versions. I think this may be a duplicate of a previous issue. Will close for now and search for the issue.

@Robinlovelace
Copy link
Member

Robinlovelace commented Dec 12, 2022

The issue was diagnosed and fixed here: #466

Here's how I found it (not easy to find as no mention of regionalisation in the issue): https://github.com/ropensci/stplanr/issues?q=regionalisation

mem48 added a commit that referenced this issue Jan 12, 2023
Fix for bug identified in #510 problem occurs when input lines have repeated coordinates for some reason this is acceptable in long linestrings st_is_valid == TRUE but not short linestrings st_is_valid == FALSE
@mem48 mem48 mentioned this issue Jan 12, 2023
mem48 added a commit that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants