TWKB / Specification

An effort to come up with a compressed binary vector geometry specification
86 stars 10 forks source link

Proposal for new group types #10

Closed nicklasaven closed 9 years ago

nicklasaven commented 9 years ago

In TWKB-spec now (2015-04-05) there is 4 "aggregate"-types. The purpose of those is to keep a group of geometries together. That is done by setting a n_geoemetries value in the beginning.

There is a few more things that makes a group of geoemtries in a group type different from just getting the twkb-geometries in line after each other.

In the group types the delta-value is continued from one geometry to another. That saves a lot of space when it comes to points. The type is also not repeated for each geometry if the group is homogeneous with respect to types.

The issue here is how to define those group types. The way it is done now is not good because it is not clear what the type 21, 22, 23 and 24 means. They also doesn't cover all needs.

So here is a proposal that I think is better. But I'm not sure. Then instead of todays solution we would only have 2 group types. 20 and 21 (could be any numbers but those I don't think is used by any other format.

Here is the definition.

type 20, A homogeneous group of twkb-geometries. So if type is 20, what follows is: 1) new type-number 1-7 telling what is coming 2) n_geometries telling how many of the above type (1-7) that is following 3) then comes the geometries as type 1-7 without further type-description

type 21, A heterogeneous group of twkb-geometries. So if type is 21 what follows is: 1) new type-number 1-7 or 20 or 21 (the group can contain sub-groups) 2) n_geometries telling how many of above type is following 3) then comes the geometries with new type-description for each geometry.

javisantana commented 9 years ago

with type 20 you say the next byte contains the type. I understand the other bits are the same for all the geometries, right?

for type 21 I'd say that the next byte should be the number of geometries, you don't need that byte since each geometry could be 20 or 21 for subgroups, right?

nicklasaven commented 9 years ago

I think you are right. When I look at it now I don't see what I can have meant.

You are right!

pramsey commented 9 years ago

Yes, two group types, one homogeneous, one heterogeneous, makes sense to me.

nicklasaven commented 9 years ago

This is not valid any more because of the new spec without this type of groupes