-
-
Notifications
You must be signed in to change notification settings - Fork 474
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
Support for TWKB output #1085
Comments
I have done a lot of refactoring on the code that creates the geometries for PostgreSQL/PostGIS in the last months. It should now be relatively straightforward to add in code for generating TWKB instead of the default EWKB. But it's not something high on anybody's priority list and it's unclear whether it is worth the extra complexity. If somebody wants to tackle this: Look for the |
I have been using ST_AsTWKB function from PostGIS to generate the tables for my example. Maybe these can be re-used. TWKB will only make sense for an epsg:4326 version of the database. If I correctly understand the geom_to_ewkb function correctly, the geometry is passed in geom format which I assume would be floating-point, right? I don't know if converting fixed-point raw osm to floating point and back to fixed-point (for twkb) will work well. |
Unfortunately you can not use Yes, the geometry classes in osm2pgsql use double precision floating point values for the coordinates. That's what you have to work with. |
Would it be possible to define a generated column via the Lua style? If we could create generated columns it could be defined with |
The sole reason for using TWKB is to reduce table size thus adding an additional column would invalidate using TWKB at all. |
TWKB is a multi-purpose format for serializing vector geometry data into a byte buffer, with an emphasis on minimizing size of the buffer. The format is already supported by PostGIS.
See https://github.com/TWKB/Specification/blob/master/twkb.md for details.
It is somewhat similar to PBF format.
While this will impact the database import and query speed in some way it will help to reduce the size of production tables in a significant way.
Importing a small extract of the planet I was able to reduce the size of the standard production tables by 36.3 % using seven digits after the decimal point, which should be the original resolution of the imported OSM data.
Here are the results of calling pg_relation_size on them:
A TWKB output option might well make sense using the generic backend as well as the new flex backend.
The text was updated successfully, but these errors were encountered: