Skip to content
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

Use libosmium for geometry building #684

Merged
merged 30 commits into from
Mar 3, 2017
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7b39ca8
improve constness of parsed osmium objects
lonvia Jan 13, 2017
33f4cc7
add node retrival functions without projection
lonvia Jan 13, 2017
c8bc82f
initial version of osmium geometry building in output-pgsql
lonvia Jan 20, 2017
cf7e824
expire directly from wkb
lonvia Jan 22, 2017
0057767
add linemerger for route relations
lonvia Jan 24, 2017
728a4ff
add multipolygon split-up
lonvia Jan 25, 2017
e1b75a5
convert remaining outputs to libosmium
lonvia Feb 2, 2017
9bab69e
move wkb writing in a separate class
lonvia Feb 3, 2017
1c298b8
remove geometry builder and geos dependency
lonvia Feb 3, 2017
3d5c53d
remove unused functions from expire
lonvia Feb 3, 2017
dfd4a51
remove now unused write_row functions in table
lonvia Feb 3, 2017
29bd6cc
remove unused get_node_list() function for nodelist_t
lonvia Feb 4, 2017
a73c5ee
fix area string conversion
lonvia Feb 4, 2017
f5ddbc6
remove remaining traces of nodelist types
lonvia Feb 4, 2017
9822c40
streamline retival of ways for relations
lonvia Feb 4, 2017
b27b1b3
add converter from hex to binary wkb
lonvia Feb 4, 2017
0d491cf
output-multi: compute way_area only when there is a column with the name
lonvia Feb 4, 2017
eb9ec38
remove unused exclude-invalid-polygon option
lonvia Feb 4, 2017
7a354f2
remove unused code
lonvia Feb 4, 2017
e5837d7
Remove remaining geos references
pnorman Feb 7, 2017
04895af
Remove exclude invalid polygon references
pnorman Feb 8, 2017
7e880ab
update to newest libosmium version
lonvia Feb 10, 2017
cd9a0a7
fix number of polygons when creating MP
lonvia Feb 12, 2017
14130fc
fix location lookup in nodes table when node appears twice
lonvia Feb 12, 2017
364cb40
ignore invalid nodes when building areas
lonvia Feb 12, 2017
d491146
restore previous polygon behaviour
lonvia Feb 12, 2017
0333e11
adapt regression tests to new libosmium geometry creation
lonvia Feb 12, 2017
e7e355b
use size_t type for position
lonvia Feb 14, 2017
5131a63
check for bad endian setting when converting hex WKBs
lonvia Feb 28, 2017
b2a2d58
improve bad endian exception message
lonvia Mar 1, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 14 additions & 10 deletions wkb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,22 @@ enum geometry_type : uint32_t
wkb_srid = 0x20000000 // SRID-presence flag (EWKB)
};

enum wkb_byte_order_type_t : uint8_t
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
Endian = 1 // Little Endian
#else
Endian = 0, // Big Endian
#endif
};

/**
* Writer for EWKB data suitable for postgres.
*
* Code has been largely derived from osmium::geom::WKBFactoryImpl.
*/
class writer_t
{
enum wkb_byte_order_type_t : uint8_t
{
XDR = 0, // Big Endian
NDR = 1 // Little Endian
};

std::string m_data;
int m_srid;
Expand All @@ -46,11 +50,7 @@ class writer_t

size_t header(std::string &str, geometry_type type, bool add_length) const
{
#if __BYTE_ORDER == __LITTLE_ENDIAN
str_push(str, NDR);
#else
str_push(str, XDR);
#endif
str_push(str, Endian);
str_push(str, type | wkb_srid);
str_push(str, m_srid);

Expand Down Expand Up @@ -230,6 +230,10 @@ class parser_t
}
}

if (out[0] != Endian)
throw std::runtime_error(
"Endian setting of database WKB not supported.");

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we say what the endianness of osm2pgsql is in the error message?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or better yet, something like "Different endian settings of database and osm2pgsql are not supported. Database is big-endian, osm2pgsql is little-endian."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return out;
}

Expand Down