zonebuilders / zonebuilder

Divide geographic space into discrete chunks
https://zonebuilders.github.io/zonebuilder/
GNU General Public License v3.0
35 stars 2 forks source link

Set default starting angle at 30 #8

Closed Robinlovelace closed 4 years ago

Robinlovelace commented 4 years ago

Because having a 'north quadrant' is not so important now with the 'clock system'. It will be more like a clock. Heads-up @mtennekes

mtennekes commented 4 years ago

@Robinlovelace best wishes for 2020 :-)

What do we want to achieve with starting_angle?

In the current implementation, the starting angle defines the angle of the border with segment at the anti-clockwise side. So for the default clock-method, the first segment is 1:00, and therefore, the starting angle is 15, which is the border between 1:00 and 12:00 (the anti-clockwise segment). PS: we can also opt for starting with 12:00, which also makes sense, but that is a different discussion. In that case, the starting angle as currently implemented should be -15. For the quadrant method, it is -45, since that is the start of the north quadrant.

I think the current implementation makes sense, but maybe not easy for all users. On the other hand, do mainstream users need to specify the starting angle?

Please let me know if you have other interpretations/uses in mind for the starting angle.

Robinlovelace commented 4 years ago

I think making the zoning system as easy to use as possible is what we want to achieve with starting_angle. I think that means making the starting angle 360 / 12 = 30, but am not sure without trying. As close as possible to a clock face is my thinking in which North is 12 and, somewhat counter-intuitively, the 1st segment starts at 30 degrees (I hadn't considered this before):

image

Does that sound like a reasonable 'direction' of travel ; ) ?

A related idea that is used for navigation is 'clock direction' and I was thinking it could be good to use this in the simple zoning system: https://en.wikipedia.org/wiki/Clock_position

Robinlovelace commented 4 years ago

Happy NY to you too btw!

mtennekes commented 4 years ago

I am not sure if you are aware of the fact that our 12 o'clock segment actually starts at 11:30 and ends at 12:30. Therefore, the starting angle in our current implementation is -15 and not 0. For the 1 o'clock segment, which goes from 12:30 to 1:30, the starting angle is 15 (and not 30).

Now I doubt whether we need a starting angle at all. In the clock-analogy, the 12 is always directed northwards. Not sure if there are any applications where it makes sense to have 12 directed to another direction. Also for the quadrants-approach, north is always north, so why change that? Agree?

What we could do with starting angle is to determine the order of zones come the data frame. Then it would make sense to specify e.g. starting_angle = 3, which means clock zones are in the order 3:12, 1:2 (so clockwise ordering starting at 3 o'clock).

Robinlovelace commented 4 years ago

I am not sure if you are aware of the fact that our 12 o'clock segment actually starts at 11:30 and ends at 12:30.

I am aware of that and raised this issue to initiate discussion of the pros and cons of changing that default (updated the issue now, should have said 'set default angle for 12:00 at 0' or the new updated issue title). For the quadrants approach it makes sense to have a 'North' quadrant for sure. But I don't think it does for the clock approach, which users could logically expect to reflect a clock. Not sure what you mean with

What we could do with starting angle is to determine the order of zones come the data frame

but I think reproducible examples will help with the discussion. With that end in mind, see below. I can see +s and -s of both approaches but want to ensure we've considered them before 'tying down' default argument values for starting_angle in zoning systems inspired by a 12 hour clock:

# aim: show angles

library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.2, PROJ 6.2.1
devtools::install_github("zonebuilders/zonebuilder")
#> Downloading GitHub repo zonebuilders/zonebuilder@master
#> 
#>      checking for file ‘/tmp/RtmpHr5yN1/remotes40df27418eba/zonebuilders-zonebuilder-3cdc3a8/DESCRIPTION’ ...  ✔  checking for file ‘/tmp/RtmpHr5yN1/remotes40df27418eba/zonebuilders-zonebuilder-3cdc3a8/DESCRIPTION’
#>   ─  preparing ‘zonebuilder’:
#>    checking DESCRIPTION meta-information ...  ✔  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#> ─  looking to see if a ‘data/datalist’ file should be added
#>   ─  building ‘zonebuilder_0.0.0.9000.tar.gz’
#>      
#> 
#> Installing package into '/home/robin/R/x86_64-pc-linux-gnu-library/3.6'
#> (as 'lib' is unspecified)
library(zonebuilder)
plot(zonebuilder::zb_zone(zonebuilder::zb_region)["segment_id"])

detach("package:zonebuilder", unload = TRUE)
devtools::install_github("zonebuilders/zonebuilder", ref = "starting-angle")
#> Downloading GitHub repo zonebuilders/zonebuilder@starting-angle
#> 
#>      checking for file ‘/tmp/RtmpHr5yN1/remotes40df39793ee3/zonebuilders-zonebuilder-12fcea9/DESCRIPTION’ ...  ✔  checking for file ‘/tmp/RtmpHr5yN1/remotes40df39793ee3/zonebuilders-zonebuilder-12fcea9/DESCRIPTION’
#>   ─  preparing ‘zonebuilder’:
#>      checking DESCRIPTION meta-information ...  ✔  checking DESCRIPTION meta-information
#>   ─  checking for LF line-endings in source and make files and shell scripts
#>   ─  checking for empty or unneeded directories
#> ─  looking to see if a ‘data/datalist’ file should be added
#>   ─  building ‘zonebuilder_0.0.0.9000.tar.gz’
#>      
#> 
#> Installing package into '/home/robin/R/x86_64-pc-linux-gnu-library/3.6'
#> (as 'lib' is unspecified)
library(zonebuilder)
plot(zonebuilder::zb_zone(zonebuilder::zb_region)["segment_id"])

Created on 2020-01-03 by the reprex package (v0.3.0)

Robinlovelace commented 4 years ago

Thoughts? I think the zone 12 directly ahead makes sense but just wanting to see what you think of zone 12 being just East of due North... Now thinking the current default may be best.

mtennekes commented 4 years ago

Yep, I think so too. A reason to set starting angle at 0 (like in your second map), is that it reflects the hour. E.g. the yellow segment corresponds with the time interval between 12:00 and 12:59.

However, if you refer to segment/zone 12, people almost certainly have 0' in mind as the true direction, and not 15' (12:30). The same holds for the other zones as well. That is why I think it may be even better to keep the default and ditch starting_angle for the standard user.

mtennekes commented 4 years ago

Not sure what you mean with

What we could do with starting angle is to determine the order of zones come the data frame

I mean adding a different parameter (which we could call starting_angle again), that specifies the order in which the zones/segments occur in the data.frame.

I could image that in some cultures north is not first cardinal direction, but for instance east. Although the clock does not change, it make sense that the first row in the resulting data.frame is zone 3, the second row zone 4, etc. (Strictly speaking, the omni-directional center will be the first, but I hope you see my point).

Robinlovelace commented 4 years ago

Aha OK, I think that's a good suggestion but not a priority for now, Zone A, B1:12, C1:12 is good I think so closing for now.