-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TWKB feedback for discussion #5
Comments
Thanks Tom, this is great things to discuss. Warning, this will be a little long. I have a little different perspective. I do not say the conclusions is right though. I fully agree that the precission must support negative values. I think also supporting bounding boxes is good. Maybe also srid/epsg should be supported. I look at twkb as ”tiny wkb”. By that I mean that it is a smaller and more flexible variant if wkb. I don't look at it as a complete transportation format wich would lead me to the same conlusion as you do that it needs a structured container. I think twkb can be carried by a container but not be the container itself. I will try to explain why I think twkb shall only be the spatial part of the data.
To say this in another way: I think twkb shall be a candidate for the geometry type in geopackage http://www.opengeospatial.org/standards/geopackage From this perspective tthe discussion is what belong to twkb and what belong to an outher container. One very interesting part of this is also how to look at vector data in general. When dealing with rasterdata and tiles it is important that the data you send is ”ready to show” when it reaches the client. That the work client side is minimal. That is because every zooming needs new data. I think that one of the most interesting things with handling vector data instead is that the client can use the same data sent from the server for many zoom levels. It will cost in simplification and so on but the format you get the data in from the server gets less important. Then it is more important that you get the data as compressed as possible since you will get a lot more details than you ask for when zoomed out. From that way of seeing it it is not htat bad if you have to read the data sequentially and parse it. You do that, put it in some way of storage and use it from there when the user zooms in. Parsing twkb is also faster in most computors I have tested than parsing the same data as JSON. Does it make sense to use this perspective of twkb that it only is for the spatial part? |
Thanks for the reply. OK, so if I understand correctly, the goal with TinyWKB is to be an alternative to WKB, i.e. a way of encoding a geometry in binary, with no encoding of attributes. In this case, does it make sense to remove the encoding of the "id" attribute both as applied to a single geometry (types 1, 2, 3, 4, 5, 6, 7) and when applied to multiple distinct geometries (types 21, 22, 23, 24)? To avoid the "spatial is special" problem you highlight, how about using an existing compact format (e.g. MsgPack, Cap'n Proto, BJSON etc.)? Have you compared the size of TinyWKB compared to the same data in WKB and gzip'd? Note that almost all clients and servers support transparent gzip'ing over HTTP, and that the gzip'ing can be done in fast, native code in the browser, in parallel with JavaScript execution. |
Not only an alternative to wkb. By adding the id as a part of the geometry type it is more independent of the container. The geometries can be aggregated to tiles or used as parts in a topological model client side and so on. About the question if type 21 to 24 is relevant I think you have a point. I am not sure. They don't add so much value from just putting many individual geometries after each other. When I created them I thought that they maked sense as they are created from a aggregation function in PostGIS. About other compact formats as you mention I don't know. I haven't tested. But I believe that a format and compression tailored for it's purpose can be more efficient than a generic one. What I want to avoid is to say "spatial is so special" so we don't have to follow common good practice like good database design. It is very possible that I use the arguments for my own purposes only, but that is not my intention :-) About gzipping wkb I haven't tried it before but I did now with one singele example so it doesn't give the whole trought. But I used the "areal types" layer that I use her: The compare is not fair since the twkb ony holds 5 decimals and the wkb have space for full double precision values. But you cannot reduce that space it occupies and obviously in y example at least the gzipping wasn't doing that big differnce. With geojson the zipping makes big difference. A zipped geojson is not that much bigger than twkb. At least less than the double. You can see it here: Another gain I think at least when reading the geometry directly from the database is that the server never have to handle the full blown uncompressed geometries. In PostGIS the geometry is read and parsed the same way as when it is used in any native spatial funtion like ST_Area or ST_Distance. From that it is directly encoded and compressed. It is never parsed to wkb or some other format. I think that can be of importance on high traffic servers. It is quite a lot faster to write a big table to a new table as twkb instead of wkb internally in the database. I read that as the data pumping inside the database is a good thing to reduce. That will not be reduced by methods where a web serer software for instance packs data into some great format. But I guess you are right that the ungzipping is more efficient when we are in a javascript environment since it is done in native code. But also parsing wkb can be done in parallel with web workers, or ? But as I have said earlier, this is only my thoughts I and my intention is that twkb shall survive my own ego so I hope that we find some way to make it good. This type of discussions is very important to get there. |
About opening for negative precision values: But how to encode it as signed? Should we use the two's compliment method as ordinary integers or "zig-zag enconding" like the varInt used for the rest of twkb? Or is there other options too? |
Good stuff @nicklasaven! Note that I'm no longer working in the open source/geospatial/ol3 world and so can no longer contribute to the project. All the best! |
That was bad news Tom. |
Refs openlayers/openlayers#1615 and openlayers/openlayers#1718.
The TWKB format is very promising, particularly in the use of delta encoding for small transfer sizes. However, I think there are a number of opportunities for improvement:
Concrete suggests:
The text was updated successfully, but these errors were encountered: