-
Notifications
You must be signed in to change notification settings - Fork 818
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
Database-reload #2128
Database-reload #2128
Conversation
@gravitystorm Would you be able to do a test-run of the import on one of your servers? Doesn't need to be full-planet, but it would be good to have done at least some testing. |
Layer should be an integer. 👎 to having two z_orders, 👎 to trying to maintain compatibility |
end | ||
|
||
-- Filter out objects with 0 tags | ||
if numberofkeys == 0 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this branch first as it's a shorter exit and very common
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can do this, as line 257-267 might change the numberofkeys variable? Objects with for example only a note of fixme tag are quite common. Or would you be ok with leaving some objects with 0 tags in the database?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the numberofkeys == 0
case is so common it needs to be handled first, even if another check is done at the end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
The area determination logic is duplicated, put it in its own function |
Can you edit the git commit message to have a more useful first line? This is a major change, so we'll be seeing it a lot in
|
**This is a pull-request against the lua branch** This PR proposes a database-reload. It changes the documentation on the use of osm2pgsql, and adds a .lua file for preprocessing. This database import aims to be backwards compatible with older versions of the style. This resolves (at least part of) gravitystorm#1504. #Hstore Adding the hstore option to osm2pgsql allows the database to use all keys. This PR proposes using hstore for new keys, and using traditional columns for old keys. This allows us to stay compatible with old versions of the style. According to [@pnorman's benchmarks](http://www.paulnorman.ca/blog/2014/03/osm2pgsql-and-hstore/), using hstore without dropping columns would lead to a 9% size increase and a 0.38% speed decrease. Given the benefits of having all columns available, I would consider this acceptable. # Make polygon/linestring decision based on value This is based on the following unmerged PR to osm2pgsql: osm2pgsql-dev/osm2pgsql#346 It makes the polygon/linestring decision based on the tag value, in addition to the tag key. In particular, highway=services and junction=yes are now treated as polygon, while leisure=track, man_made=embankment, man_made=breakwater, man_made=groyne, natural=cliff, natural=tree_row, historic=citywalls, waterway=derelict_canal, waterway=ditch, waterway=drain, waterway=river, waterway=stream, waterway=wadi, waterway=weir, power=line, and power=minor_line are now treated as linestring. This resolves gravitystorm#1362, resolves gravitystorm#137, resolves gravitystorm#268, and resolves gravitystorm#892. # Rendering order The new .lua file creates a osmcarto_z_order value in the database, which stores the rendering order we use. This will allow us to simplify the road queries. # Recommend -G flag for multipolygons This resolves gravitystorm#59. # Import ele on buildings This resolves gravitystorm#101. # Delete more meta-tags from imports The .lua file drops some more meta-information from imports that is of no need for rendering. This is based on the following unmerged PR to osm2pgsql: * osm2pgsql-dev/osm2pgsql#532
d767022
to
d48106e
Compare
Done. I will come back to your other points later. |
{ 'bridge', 1, 10, 0, 0 }, | ||
{ 'tunnel', 'yes', -10, 0, 0}, | ||
{ 'tunnel', 'true', -10, 0, 0}, | ||
{ 'tunnel', 1, -10, 0, 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines have an extra leading space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Fixed |
We specify in the documentation that osm2pgsql should be run with openstreetmap-carto.style, so if the OSMF tile server maintainers decide to use a different .style, in a way that's their problem. In practice of course they are our main 'customer', so it's not something we can ignore. I wonder what other tile servers that run openstreetmap-carto do - use our style or use the osm2pgsql default one? For context, both styles were identical until osm2pgsql diverged a couple of months ago. Basically we have three options: 1) Drop the column z_order altogether (we still keep osmcarto_z_order) 2) Import z_order as currently defined by osm2pgsql and used on the OSMF servers (in addition to osmcarto_z_order) 3) Import z_order as currently defined by openstreetmap-carto.style (in addition to osmcarto_z_order) Feel free to extend. @gravitystorm Would you be able to make the final decision? The current proposal implements 3), but on changing the proposal to 1) or 2) is trivial. |
The styles are still identical with respect to z_order - and z_order isn't defined in the .style file anyways. |
With the C transforms and osm2pgsql's style.lua example I have 28662 rows in planet_osm_roads with the extract I'm testing with, but 1667987 with this code, very close to the number of lines. Could 1 and 0 be flipped in what you've got? This would also account for some of the speed difference we found, since it has to do a lot more DB work |
{'railway', 'miniature', 0, 420, 1}, | ||
{'railway', 'turntable', 0, 420, 1}, | ||
{'railway', 'tram', 0, 410, 1}, | ||
{'railway', 'tram-service', 0, 405, 1}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this line work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No - not sure now where it comes from actually.
… into lua_changes
ping @math1985, I have two open PRs against this branch. |
I'm currently reviewing them. |
@pnorman's PR's have been merged. From my side this is (again) ready for review/merge. |
Have you fixed the problem with the roads table? Also, this is failing CI |
I must have missed that, what problem are you referring to?
It failed because of 'The command "./scripts/travis_check_project_files" exited with 1.', that's a new check as far as I know, so I think this should fix itself when merging. |
It looks like you didn't run yaml2mml.py |
I cannot reproduce this. For Luxembourg, I get these numbers (old/new): planet_osm_point 45338/48484 @pnorman Can you reproduce this problem with the Luxembourg abstract? |
Fixed. |
I'm having trouble reproducing, I'll try further debugging |
This is a pull-request against the lua branch
This is a new version of #2105. No changes except for dropping some commented lines.
This PR proposes a database-reload. It changes the documentation on the use of
osm2pgsql, and adds a .lua file for preprocessing.
This database import aims to be backwards compatible with older versions of
the style.
This resolves (at least part of) #1504.
Hstore
Adding the hstore option to osm2pgsql allows the database to use all keys.
This PR proposes using hstore for new keys, and using traditional columns for
old keys. This allows us to stay compatible with old versions of the style.
According to @pnorman's benchmarks,
using hstore without dropping columns would lead to a 9% size increase and a
0.38% speed decrease. Given the benefits of having all columns available, I
would consider this acceptable.
Make polygon/linestring decision based on value
This is based on the following unmerged PR to osm2pgsql:
osm2pgsql-dev/osm2pgsql#346
It makes the polygon/linestring decision based on the tag value, in addition to
the tag key. In particular, highway=services and junction=yes are now treated as
polygon, while leisure=track, man_made=embankment, man_made=breakwater,
man_made=groyne, natural=cliff, natural=tree_row, historic=citywalls,
waterway=derelict_canal, waterway=ditch, waterway=drain, waterway=river,
waterway=stream, waterway=wadi, waterway=weir, power=line, and power=minor_line
are now treated as linestring.
This resolves #1362, resolves #137, resolves #268, and resolves #892.
Rendering order
The new .lua file creates a osmcarto_z_order value in the database, which stores
the rendering order we use. This will allow us to simplify the road queries.
Recommend -G flag for multipolygons
This resolves #59.
Import ele on buildings
This resolves #101.
Delete more meta-tags from imports
The .lua file drops some more meta-information from imports that is of no
need for rendering.
This is based on the following unmerged PR to osm2pgsql: