Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Rendering specific access tags #4952
Rendering specific access tags #4952
Changes from 3 commits
f8488d2
9c8098b
a413991
911569e
8f386d2
e04589c
a300250
8f92b8d
42a9e75
f99920e
cdc9ace
987258c
a1dfd94
194d641
c4c775c
15c75d6
1d369dc
b1f77c2
af8400a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
You here distinguish between a two class and a three class access restriction model based on the primary mode - while we make this distinction based on road class. While this might not be significant in the exact design model you propose, it would be in many styling variation (like for example if you render
highway=track
with primary modemotorcar
).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.
Yes and no. I renamed the functions to
carto_highway_primary_mode
etc. and returned a "primary mode" for clarity, whereas it's really an "access type", so you could classify intomotorcar_track
if you wanted to have a 2 class access style for track. I could change it back to sayaccess_mode
. I was keen not to "reparse" all the way from highway to avoid repetition and improve efficiency.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.
Primary mode of use and road class are well defined concepts - you will need to explain what you exactly mean by "access type".
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.
Fundamentally the "access category" is a data abstraction that keeps the code simple and flexible. A given way is classified into an access category, which mostly depends on the highway type, but for
highway=path
also depends on access tags. All the decisions can then be made on the "access category", e.g. this determines which mode-specific access tags are to be used, but it is also used to distinguish between 2-state and 3-states access renders. So it is a single value that encapsulate both the "primary mode" and how the different access values will be translated intoyes|restricted|no
. So in retrospect it was confusing to conflate the "access category" with "primary mode". Hopefully most of this is documented in the comments.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 think it is not a good idea to invent such concepts as parameters of implementing styling logic, especially if their meaning changes when changing the design logic.
The primary concern when implementing this should be that other style developers can easily understand and modify the tag interpretation logic. The secondary concern should be code performance since we are going to use it on the fly during rendering. Code complexity itself is lower priority.
As i said - we actually want to make this distinction based on road class, because it depends on the road class and its line signature if we can only show a two class access classification or if we can show three classes.
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.
We can call it road_class rather than access type/category. That's all it is really.
highway=cycleway
andhighway=path, bicycle=designated
belong to the same "road class" because the access marking works in the same way.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.
Then i'd suggest to simply re-cast
highway=path
intohighway=cycleway/bridleway/footway
in SQL and work with that as parameter. You essentially already have the function for that (carto_path_primary_mode()
). We currently do this re-casting in MSS code - but since you need it for the access restriction processing you can do it in SQL and then simplify the MSS code as a bonus.You'd need an additional query nesting level for that or move the
carto_highway_int_access()
call to the outer query.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.
Yes, I was thinking along these lines - an effective
int_highway
. I am keen to collapse the different road types in one place, and will have to check that this works across the wider framework.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.
This is odd - if you have a distinct primary mode
pedestrian
(and it is unclear what this means relative tofoot
): why does this universally meanaccess=no
. Note that while we currently do not renderhighway=pedestrian
with access dashing, access restricted pedestrian roads of course do exist - like in private parks or in military facilities.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.
Again, perhaps renaming "access type" as "primary mode" has hindered rather than helped. The idea of a "pedestrian" access mode was an implicit
motorcar/motor_vehicle=no
. Putting thisno
intoint_access
simplifies later queries about whether to add colour forbus=yes
etc.; only ways withint_access=restricted|no
are considered.The alternative is to set
int_access=NULL
and to treathighway=pedestrian
as a special case [IF int_access=restricted|no OR highway=pedestrian THEN <consider bus=yes marking>
]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.
This reveals an inconsistency of how we're treating access tags.
foot
,bicycle
, andhorse
get columns whilemotorcar
,motor_vehicle
, andvehicle
don't.If we're storing the raw tag text here, let's put them all in the tags column. If we're preprocessing we could have a smaller number of columns
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.
Yes, our current database schema has foot, bicycle, and horse as columns (because these have been interpreted in rendering of
highway=path
for a long time) and not the other more specific access tags. I agree that with this change this distinction would not make that much sense any more and sourcing all of them from hstore would be reasonable. But since that would involve a database reload i would suggest to do this separately. Overall, i am not sure if this is worth breaking backwards compatibility of 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.
I don't see any issue with doing a reload. Being consistent on columns is a plus, even if we aren't able to reach a consensus on any preprocessing
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 am fine with removing foot/bicycle/horse from the columns. I am just not sure if it is worth doing a database layout change breaking backwards compatibility just because of this.
We could also source foot/bicycle/horse from hstore in anticipation of such a change now and defer the actual removal of the columns to when we do a database reload anyway.
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.
This would make sense. But if we are sourcing all the detailed access tags via hstore, I suggest passing the hstore tags as a function argument to both
carto_highway_int_access
andcarto_path_type
. As well as being neater, it is presumably slightly more efficient to selectively access tags as needed rather than unpack them all to pass as function arguments [but I'm no SQL expert]?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 have to correct myself here: I wrongly remembered that tags in columns are also available in hstore, but they are not. Hence my suggestion would not work.