DonManfred Expert Licensed User Longtime User May 1, 2018 #1 I did wrote a tileproviderfor b4a to use tiles generated by a Python Script. IN: int x, int y, int Zoom to match the tilenames with the y value, i needed to use this code to transform y The Solution was to use this code (i found somewhere in the internet: don´t know what exactly it is doing but it was the solution. Java-Code Code: int reversedY = (1 << zoom) - y - 1; For the tileprovider this was ok. Now i´m in the need to do the Opposite. I have X, Zoom and the reversedY and i need Y. Can anybody help me in this? Ideally i would prefer to get a B4J Solution as i need to use it in B4J.
I did wrote a tileproviderfor b4a to use tiles generated by a Python Script. IN: int x, int y, int Zoom to match the tilenames with the y value, i needed to use this code to transform y The Solution was to use this code (i found somewhere in the internet: don´t know what exactly it is doing but it was the solution. Java-Code Code: int reversedY = (1 << zoom) - y - 1; For the tileprovider this was ok. Now i´m in the need to do the Opposite. I have X, Zoom and the reversedY and i need Y. Can anybody help me in this? Ideally i would prefer to get a B4J Solution as i need to use it in B4J.
udg Expert Licensed User Longtime User May 1, 2018 #2 Hi Don, have a look here. So, "1 << zoom" should mean "shift left the representation of number 1 by zoom positions". Last edited: May 1, 2018 Upvote 0
Hi Don, have a look here. So, "1 << zoom" should mean "shift left the representation of number 1 by zoom positions".
Star-Dust Expert Licensed User Longtime User May 1, 2018 #3 This is translate Code: Dim ReservedY as int = (Bit.ShiftLeft(1,zoom) - y - 1 After i invert it Upvote 0
DonManfred Expert Licensed User Longtime User May 1, 2018 #4 Ok, so you now rewrote the java-part, right? The javapart is already working in my b4a Lib and is OK. BUT now i need the opposite. In B4J i need to evaluate Y from the given reversedY, Zoom and X Values. Upvote 0
Ok, so you now rewrote the java-part, right? The javapart is already working in my b4a Lib and is OK. BUT now i need the opposite. In B4J i need to evaluate Y from the given reversedY, Zoom and X Values.
Star-Dust Expert Licensed User Longtime User May 1, 2018 #5 DonManfred said: Ok, so you now rewrote the java-part, right? The javapart is already working in my b4a Lib and is OK. BUT now i need the opposite. In B4J i need to evaluate Y from the given reversedY, Zoom and X Values. Click to expand... Correct Code: Y=Bit.ShiftLeft(1,zoom)-ReservedYReservedY-1 Last edited: May 1, 2018 Upvote 0
DonManfred said: Ok, so you now rewrote the java-part, right? The javapart is already working in my b4a Lib and is OK. BUT now i need the opposite. In B4J i need to evaluate Y from the given reversedY, Zoom and X Values. Click to expand... Correct Code: Y=Bit.ShiftLeft(1,zoom)-ReservedYReservedY-1
DonManfred Expert Licensed User Longtime User May 1, 2018 #7 Looks good. GREAT. Thank you very much! Star-Dust said: Work it? Click to expand... I need to check answer from my customer as he is using a Windowssoftware where the Tiles should be used. The Software is using a SQLite DB for the Tiles. The Import to the SQLite is already done; must be tested now. I´ll inform you about the results. Upvote 0
Looks good. GREAT. Thank you very much! Star-Dust said: Work it? Click to expand... I need to check answer from my customer as he is using a Windowssoftware where the Tiles should be used. The Software is using a SQLite DB for the Tiles. The Import to the SQLite is already done; must be tested now. I´ll inform you about the results.
Star-Dust Expert Licensed User Longtime User May 1, 2018 #8 Looking at it better than code is actually a simple difference from a basic exponent 2 ReservedY = 2 ^ zoom-y-1 Probably in php it is easier to shift that the elevation to powern. In B4X. Would be: Code: ReservedY = Power (2, zoom) -y-1 It could also be understood as a 2-compliment Last edited: May 1, 2018 Upvote 0
Looking at it better than code is actually a simple difference from a basic exponent 2 ReservedY = 2 ^ zoom-y-1 Probably in php it is easier to shift that the elevation to powern. In B4X. Would be: Code: ReservedY = Power (2, zoom) -y-1 It could also be understood as a 2-compliment