Curious about creating an S2CellID from a FaceIJ and level #221
Replies: 3 comments 6 replies
-
You're looking for something like |
Beta Was this translation helpful? Give feedback.
-
Using Python pseudo-code: This is equivalent to reading off pairs of bits from the cell id: Line 66 in ad1489e Line 599 in ad1489e But if that's your question, I'm confused as to why you mention |
Beta Was this translation helpful? Give feedback.
-
Yes, that will work. There's probably no function for that since it's just a shift. What are you actually trying to do? Unless you're writing a tutorial about the coordinate systems, this is probably using the library at a lower level than necessary. |
Beta Was this translation helpful? Give feedback.
-
I've been looking at the code for a while and curious if there is a creative way to go from FaceIJ+level to S2CellID and back again
To expound on this:
if The max level was say "2", then the maximum for I and J are "4".
The idea here is that I have an algorithm that sometimes uses IJ at various depths and I'm curious the easiest way to get to an S2CellID that complements the depth.
should I just bit shift the IJ to maxLevel, create an S2CellID then find its parent at the level I was originally in or do you have a superior alternative?
essentially I assume it is something like this before FromIJ:
then after getting the s2cell parent at level, heading back and after ToIJ:
while the math works from tests, I'm nervous there is something I am missing. The way I visualize it though, this seems to work.
Beta Was this translation helpful? Give feedback.
All reactions