How do I compress an array of coordinates?
The database contains polygons with a large number of coordinates. When a user enters a web application, these polygons are requested and drawn on the map. The weight of the answer is 7mb +, where almost all of this weight is coordinates.
These polygons are often edited, so it's not an option to cache them all the time. I would like to represent the coordinates of the polygons in the form of strings (to reduce the weight, I hope there are some algorithms for this), and then at the front to parse them back into arrays of coordinates.
I understand that gzip already works when requested, but this is still not enough.
Look at this option, it's a binary json, so nothing much will change, but it's more compact.
However, it is possible that gzip compression on top will not be as efficient.
This is more likely a question - is it possible to somehow process these polygons, depending on the magnification, give enlarged ones, when zooming in, give only those that fit on the screen.
Severely complicates logic, but can ease trafficAnonymous
Read about protobuff - it might help you.Anonymous
If you transfer them as a string that can be parsed, then transfer the data via JSONAnonymous
To place the code, please use CodePen or similar tool. Thanks you!