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

Move control over road rendering order to SQL #626

Merged
merged 4 commits into from
Aug 6, 2014

Conversation

matthijsmelissen
Copy link
Collaborator

Currently, rendering order of road rendering within one layer is handled
by the z_order column, which comes from osm2pgsql. As such, we have
little control over road rendering without reloading the database.
This PR moves control over the rendering order to the SQL query.

This adds complexity to the SQL queries, but increases customizability,
and simplifies the roads.mms code.

This solves the following issues:

@matthijsmelissen
Copy link
Collaborator Author

On my system (with only Luxembourg loaded) I don't notice any effects on performance. However, perhaps it would be good if someone could test performance on systems with a larger database.

@pnorman
Copy link
Collaborator

pnorman commented Jun 12, 2014

it would be good if someone could test performance on systems with a larger database

Importing the planet now to do a test.

@Rovastar
Copy link
Contributor

If you post a comparison to your test server/machine I'll have have a look especially if you have the UK that I know where problem areas might occur

@matthijsmelissen
Copy link
Collaborator Author

If you post a comparison to your test server/machine I'll have have a look especially if you have the UK that I know where problem areas might occur

In terms of rendering not a lot will change. Do you have a link to areas you're interested in?

@matthijsmelissen
Copy link
Collaborator Author

This also solves #611.

@matthijsmelissen
Copy link
Collaborator Author

@gravitystorm Apart from the merge conflict, do you agree with merging this?

@pnorman
Copy link
Collaborator

pnorman commented Jul 4, 2014

pinging myself on this

@matthijsmelissen
Copy link
Collaborator Author

I have rebased this PR.

@pnorman pnorman self-assigned this Jul 11, 2014
@matthijsmelissen
Copy link
Collaborator Author

@pnorman Did you have time to look at this already? It changes quite a lot of code, so I would like to merge it as soon as possible.

@pnorman
Copy link
Collaborator

pnorman commented Jul 20, 2014

Testing db84b2b now. I'll test d40f6b9 after.

@pnorman
Copy link
Collaborator

pnorman commented Jul 21, 2014

Normal (d40f6b9) rendering speed 8.075 MT/s, SQL re-ordering (db84b2b) rendering speed 8.086. This is statistically significant and a speed increase of 0.1%. This also holds true for with a colde cache, but that result might not be statistically significant.

Database not clustered (order by way), no custom indexes.

Looking at per zoom results, there's a minor slowdown on z18 which may be below statistical significance, and increasing speedups with decreasing zoom. None are very significant, with the overall being 0.1%, and I'm not positive all are statistically significant on their own.

@pnorman pnorman assigned gravitystorm and unassigned pnorman Jul 21, 2014
@pnorman
Copy link
Collaborator

pnorman commented Jul 21, 2014

Assigned to @gravitystorm for review and merging if acceptable.

@matthijsmelissen
Copy link
Collaborator Author

@pnorman Thanks!

@matthijsmelissen
Copy link
Collaborator Author

@gravitystorm Could you prioritize the review of this PR? It's a rather large PR, so I'd rather not have to rebase this every week.

::casing {
[zoom >= 12] {
[feature = 'highway_motorway_link'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Has the "_link" not been removed from the feature value by the SQL query? Why does this (and further occurrences elsewhere in this file) still explicitly test for "highway_motorway_link"?

@matthijsmelissen
Copy link
Collaborator Author

Thank you, it shouldn't. I will look at it.

@matthijsmelissen
Copy link
Collaborator Author

Fixed. Thanks again @woodpeck.

@matthijsmelissen matthijsmelissen removed their assignment Aug 1, 2014
Currently, rendering order of road rendering within one layer is handled
by the z_order column, which comes from osm2pgsql. As such, we have
little control over road rendering without reloading the database.
This PR moves control over the rendering order to the SQL query.

This adds complexity to the SQL queries, but increases customizability,
and simplifies the roads.mms code.

This solves the following issues:

* gravitystorm#462 (Move rendering order road types from osm2pgsql to our SQL queries)
* gravitystorm#163 (Railways are now drawn above roads)
* gravitystorm#167 (Tramway layering issues)
* gravitystorm#168 (Paths are now drawn below link roads)
* Trac 2024 (Service roads are now rendered below link roads)
* Trac 3649 (Service roads are now rendered below race tracks)
* Pedestrian and living streets are now consistently ordered
* Footways are now always displayed under service ways
This corrects a mismatch between the queries and the style sheet for
the roads-low-zoom and roads-text-name layers.
This should not have influence on performance.
@matthijsmelissen
Copy link
Collaborator Author

And rebased.

@matthijsmelissen
Copy link
Collaborator Author

Converted trac references to Github references.

@gravitystorm gravitystorm merged commit d89c6e2 into gravitystorm:master Aug 6, 2014
@gravitystorm
Copy link
Owner

Merged, great work. I'm disappointed that we need to involve this level of complexity in the SQL queries though - especially because it'll need to be used over and over in so many different projects. So when we're happy with the ordertable stuff and fix any bugs that are yet to be found, we should take it upstream to osm2pgsql somehow.

@matthijsmelissen
Copy link
Collaborator Author

Yes, agreed. And thanks for merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants