[postgis-devel] TWKB update

Nicklas Avén nicklas.aven at jordogskog.no
Mon Mar 25 18:12:31 PDT 2013


Hallo

Since many of you are at the code sprint I would like to share what I
have done late nights lately, even if I would have liked to have some
more proofs that twkb might be a good thing. All code is also quite
messy and far from well commented.

I wish I was there to join you in Boston.

First, twkb is a very bad name, I know. It is not "well known" so it
shouldn't be a name close to that. So that name is not to live for long.

Second, here is a live test:
http://178.79.156.122/twkb

To get the vector-map click the checkboxes at the bottom.

It seems to work as expected at least in chrome.

The bottleneck is not building twkb or reading it client side, but to
get the polygons into the map in leaflet. Probably there is a lot of
optimizations to do, and that is not a problem of twkb.

Also the binary reading can be improved.

A few words about the data sets:

Municipalities of Norway is about 430 polygons with about 140000
vertex-points in total.


The "Areal Types" layer is about 3550 polygons with about 179000
vertex-points in total.

The difference in size of those layers is not very big compared to
compressed geojson. But from reading the data on disk on the server it
is quite small all the way out of the database, to php, over the network
to the client. But than it gets bigger when read into a javascript
object of course.

There is two things that I think would be possible and good.

Send edges from a topology with twkb and send the information avout what
edges builds what polygon in a separate table. Since twkb holds its own
id, it should be possible for som javascript hacker to get the process
of building polugons on the client side quite effective if stored in
indexddb or maybe websql.

The other idea is to create an  aggregate function in postis like
ST_Collect, but handling twkb. The point is that then every nested
geoemtry in the collection will still hold it's own id. THat should give
good possibilities for creating vektor tiles directly in the database.
Maybe even in request-time.

It would also be nice to see desktop-clients use this instead of wkb. It
would decrease the IO with at least 50 % up to more than 80 % in optimal
cases when the best precision not is needed.

 
Best Regards and happy coding

Nicklas




More information about the postgis-devel mailing list