You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: blog/2025/2025-01-21-introducing-bytey/index.mdx
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,33 @@ We did start with a bit of research if any library existed for this, but nothing
30
30
31
31
You can see how `38.5` became `_p~iF` and `-120.2` became `~ps|U`. The first coordinate doesn't have much of a cost savings, but as the coordinate pairs continue and each pair has the offset from the previous you can tell how the data savings begin to take place.
32
32
33
-
We wrote a quick PHPUnit test to confirm our implementation of the algorithm, and it matched Google's documentation.
33
+
Imagine if we went to draw a box around our office we might get the coordinate pairs of:
34
+
35
+
*`28.03630, -82.49009`
36
+
*`28.03654, -82.49009`
37
+
*`28.03655, -82.49099`
38
+
*`28.03629, -82.49100`
39
+
*`28.03630, -82.49009`
40
+
41
+
This helps establish the point that most coordinates are just small iterations of the previous coordinate -- not shifting much in terms of the positioning. If we were to render those with a 19 zoom we'd get this image.
42
+
43
+
<divclass="text--center">
44
+

45
+
</div>
46
+
47
+
This would form a URL that compounded the coordinate pairs to draw the lines.
If we apply the algorithm we see a much smaller URL decreasing 94 characters to 22.
54
+
55
+
```
56
+
&markers={ybjD`jnvNo@?ArDr@@AuD
57
+
```
58
+
59
+
This was a savings of ~75% less characters and was promising for a real integration. We wrote a quick PHPUnit test to confirm our implementation of the algorithm, and it matched Google's documentation.
34
60
35
61
```php
36
62
#[DataProvider('googleDataProvider')]
@@ -65,7 +91,7 @@ public static function googleDataProvider(): array {
65
91
}
66
92
```
67
93
68
-
So we took our affected entity that was generating a 19.5k character URL and ran it through the algorithm. The new URL was 3.3k characters, which suggested an 83% reduction in character length. A few more real life tests, and we had a fix out the door and a new package built.
94
+
So we took our affected entity that was generating a 19.5k character length URL and ran it through the algorithm. The new URL was 3.3k characters, which suggested an 83% reduction in length in a more real life example. A few more real life tests, and we had a fix out the door and a new package built.
69
95
70
96
Thus, [Bytey](https://github.com/sourcetoad/Bytey) was born.
0 commit comments