-
Notifications
You must be signed in to change notification settings - Fork 823
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
roads vs tunnels vs bridges SQL queries #5033
Comments
Ok, no, in fact the |
Regarding if the queries for the roads, tunnels and bridges layers can be unified - you answered that yourself i think. You don't really want the bridges and tunnels queries to unnecessarily include all the normal roads. Still: The duplication of a lot of code between those layer is annoying. Hence ideas to avoid this are welcome. Beyond that: There is definitely room for improvement - and if you want to work on that this would be welcome as well. For example the service column could be set to You mention that
that is not true - at least not within Mapnik - PostgreSQL might cache when the same query is run multiple times. The |
Yeah, I tried converting the bridges and tunnel info into fields and replace the id filters to things like
OK, here's my plan: I'll start introducing one change at a time, get a review, then move to the next one. The question whether you prefer a single final PR or multiple small ones is up to you, but I think several small ones is better.
OK, let's make a checklist (they don't quite work, be we'll make them work :): [ ] Make sure all three have the same code except the What about |
If you just want to do internal changes without a change in rendering, grouping several smaller changes in usually fine. If you want to do larger re-structuring or visible changes it is better not to do too many things at once or to mix structural with simple form changes.
I copied that to the initial comment so github shows the progress.
|
Thanks for taking this on - I had also noticed a lot of cruft in the roads queries (e.g. creating an I'm puzzled why the roads queries contain things like Another oddity is why some "null" values are returned as A final oddity is why Plenty to go at! |
What about @imagico can you show me how to do one of those demo data sources? |
I think yes. Mapnik/Carto handling of NULL values has in the past been somewhat obscure which has probably let to the habit of using 'null' strings. I don't think this is necessary. We don't even have a filter for surface on railways in MSS i think so the value of surface there is simply irrelevant.
You mean the tag combination test sets like here - those are drawn in JOSM and run through |
I agree. I think once I tried to come up with what's actually going on there and came up gaslighted by
Huh... :) |
Ok, I started with this. The specific plan is like this: Each change goes in it's own commit, so if a particular thing is not liked it can easily be rolled back. I'll fix the query for roads-casing, and once we're satisfied, I'll copy it over the other 2, leaving the |
OK, I think this is enough for now. I will also like to add spaces after commas where permitted (not in regexps), to make it more consistent, like in |
Space after comma is currently not part of our SQL style guide. We mostly have spaces between items in In any case - changes to formatting of globally re-used blocks like |
OK, so no objections so far. I'll copy the query over the other two and let's see what it gives. |
Done, and set to ready for review. |
I noticed that the queries for those layers are slightly different, but in my opinion not enough to really have separate definitions. Here is what I found. I'm taking as a base the one that is already used elsewhere,
roads_sql
.Todos (copied from below):
WHERE
clauses. Add comments about keeping them in sync.NULL AS int_surface
on the railway branchNULL AS access
on the railway branchNULL AS service
on the railway branchShort version
Both queries differ only slightly from the roads query. In particular, they differ the same way, except on how they focus on the topic they handle. Even more, I modified my fork of this style to have a single definition for all 4 layers (namely:
tunnels
,roads-casing
,bridges
androads-fill
) and it seems to work just fine. In particular, given how bothtunnels
andbridges
use less sophisticates expression for filtering tunnels and bridges, I have the impression they have suffered from rotting, whereroads_sql
has been improved but the other two hasn't.tunnels
bridges
Proposal
Given that:
I propose to merge all 3 queries into a single query, which should include the simplification in surface handling for the railway branch, and probably similar simplification for other fields that make no sense for those ways.
I think I can provide such a patch without much effort; for the moment I'll keep developing it on my own style.
The text was updated successfully, but these errors were encountered: