-
-
Notifications
You must be signed in to change notification settings - Fork 359
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
Add new quest to determine the maxheight #960
Conversation
I was just reading code, but
(if necessary) should be rather something like
|
Wow, this is a complex one. You even took care of those imperial countries, nice.
It would be better if you do one thing after another and see it to the end, rather than creating one construction site after another, in my opinion. These days, it feels like I am spending 90% of the time I have for SC on commenting on tickets or reviewing PRs. Anyway, will review your code now... |
"(" + | ||
" node['barrier'='height_restrictor']" + QUERY_RESTRICTIONS + ";" + | ||
" node['amenity'='parking_entrance']['parking'~'^(underground|multi-storey)$']" + QUERY_RESTRICTIONS + ";" + | ||
" way['highway'~'^(" + ROADS + ")$']['tunnel'~'^(yes|building_passage)$']" + QUERY_RESTRICTIONS + ";" + |
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.
Please add avalanche_protector
to tunnel types.
{ | ||
double height = Double.parseDouble(getHeightFromInput()); | ||
double heightInMeter = isMetric ? height : feetToMeter(height); | ||
return heightInMeter > 6; |
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.
Low heights might also be implausible, maybe < 2 m?
" way['highway'~'^(" + ROADS + ")$']['tunnel'~'^(yes|building_passage)$']" + QUERY_RESTRICTIONS + ";" + | ||
" way['highway'~'^(" + ROADS + ")$']['covered'='yes']" + QUERY_RESTRICTIONS + ";" + | ||
");" + | ||
"out meta geom;"; |
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.
By the way, Overpass QL does not require '
for simple values like i.e. barrier=height_restrictor
. Would improve readability a bit.
/*TODO: maxheight=default or maxheight=no_sign? | ||
according to https://taginfo.openstreetmap.org/keys/maxheight#values maxheight=no_sign is only used 14 times, | ||
while maxheight=default is used about 10K times*/ | ||
changes.add("maxheight", "default"); |
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.
But what is maxheight=default
(or no_sign
) supposed to mean? What is the information gain here?
I think it would be better to in that case ask the user about an estimate of the height and tag the estimate then. (Choose a tagging where it is clear that this is an estimate)
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.
They’re documented on the Osm wiki ---> https://wiki.openstreetmap.org/wiki/Key:maxheight
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.
What is the information gain here?
I guess that in typical country it is mandatory to sign maxheight if it is below some value (I would expect it to be chosen so normal-sized vehicles can pass). So lack of sign indicates that normal vehicles can pass trough. Also, with this it is always possible to tag something, making this quest possible.
about an estimate of the height and tag the estimate then
At least I am not really able to estimate height with any kind of accuracy that would make worth tagging it.
} | ||
} | ||
|
||
@Override public String getCommitMessage() { return "Add maximum height"; } |
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 this is usually plural
{ | ||
boolean isParkingEntrance = "parking_entrance".equals(tags.get("amenity")); | ||
boolean isHeightRestrictor = "height_restrictor".equals(tags.get("barrier")); | ||
boolean isTunnel = "yes".equals(tags.get("tunnel")); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
@Override public int getTitle() { return R.string.quest_maxheight_title; } | ||
@Override public int getDefaultDisabledMessage() { return 0; } | ||
@Nullable @Override public Boolean isApplicableTo(Element element) { return null; } |
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. But it would be a long chain of if-checks, I figure. You could use several tagfilters. I.e.... (pseudo code)
TagFilterExpression nodeFilter = parser.parse("nodes with (barrier=height_restrictor or amenity=parking_entrance and parking ~ underground|multi-storey) and !maxheight and !maxheight:physical");
TagFilterExpression wayFilter = parser.parse("ways with highway~(primary|secondary|tertiary|trunk)(_link)?|motorway|service|residential|unclassified|living_street and (covered=yes or tunnel~yes|building_passage) !maxheight and !maxheight:physical");
return nodeFilter.matches(element) || wayFilter.matches(element);
To be honest, with a little extension on the TagFilterExpression class (adding a method that outputs the TagFilterExpression without the full thing (bbox and out geom meta;) as Overpass QL, perhaps these filters could be used as well in the getOverpassQuery method.
if (!heightInput.getText().toString().isEmpty()) | ||
{ | ||
|
||
return heightInput.getText().toString().replace(",", "."); |
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.
Where does the "," come from?
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.
Ah, I see. If the user enters it with , instead of . (in Germany, e.g.) However, I think, even the German keyboard layout for numbers limits the input to .
as a decimal separator.
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.
Right, this is why I added it...
I think, even the German keyboard layout for numbers limits the input to . as a decimal separator.
I don't think so... I even specified the possible input values (the same is done for the housenumber quest too) here:
https://github.com/ENT8R/StreetComplete/blob/59b437425c51bacc9c0fd8c8b9866c86e4f474e2/app/src/main/res/layout/quest_max_height.xml#L22
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.
ENT8R, the line you cited is not there to allow German decimal points but to allow an input like "3,5" (multiple housenumbers).
I do not believe that Android multilingual support is supposed to be that crappy that it leaves it to the app to "understand" the number of the user input.
You should set android:inputType=numberDecimal
and probably remove the android:digits="0123456789.,", then everything should be fine.
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.
Alright. Will do that!
{ | ||
if (!feetInput.getText().toString().isEmpty() && !inchInput.getText().toString().isEmpty()) | ||
{ | ||
return feetInput.getText().toString() + "." + inchInput.getText().toString(); |
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.
Not sure why you do this, but I find this dangerous. Ten inch are not one foot, twelve inch are one foot. By introducing the dot, you seem to imply that the inch are the decimal, which they are not.
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.
Yeah, true... I will have to find a better solution...
<path | ||
android:fillColor="#fff" | ||
android:pathData="M17.967,22.201c3.207,-1.6 5.235,-4.876 5.236,-8.461 -0.002,-3.585 -2.029,-6.86 -5.236,-8.461l-4.224,3.698 -4.217,-3.694C6.317,6.881 4.287,10.156 4.283,13.74c0.005,3.585 2.035,6.859 5.244,8.456l4.217,-3.694z"/> | ||
</vector> |
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.
Actually, it would also be possible to use the simple layer-list drawable (see background_maxspeed_sign.xml
). The advantage would be that it is also displayed as vector on older Android versions.
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.
Is there some chance to convert it? I don't think so, but I'm not familiar at all with those layer-list drawables...
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. But hmm, don't mind about that. Turns out that those two triangles are not possible with shape drawables alone.
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.
Alright.
app/src/main/res/values/strings.xml
Outdated
<string name="quest_maxheight_tunnel_title">What is the height limit of this tunnel?</string> | ||
<string name="quest_maxheight_answer_noSign">There is no sign</string> | ||
<string name="quest_maxheight_answer_noSign_confirmation_title">Are you sure there is no sign?</string> | ||
<string name="quest_maxheight_answer_noSign_confirmation">Did you check at both ends? If there is no sign, default limits apply.</string> |
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 doesn't make sense. What are the "default limits"? Also, it doesn't make sense (IMO) to ask the user to look at "both ends". I think it doesn't matter from which side you enter a tunnel for the height restriction to apply. :-D
res/country_metadata/heightUnit.yml
Outdated
# https://en.wikipedia.org/wiki/Metrication#Overview | ||
# https://en.wikipedia.org/wiki/Imperial_units#Current_use | ||
default: [m] | ||
CA: [ft, m] |
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.
Canada should be meter only, see https://en.wikipedia.org/wiki/Comparison_of_MUTCD-influenced_traffic_signs
Or, at least, m first, then ft.
{ | ||
if (!feetInput.getText().toString().isEmpty() && !inchInput.getText().toString().isEmpty()) | ||
{ | ||
return feetInput.getText().toString() + "." + inchInput.getText().toString(); |
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.
Although simplifying inches to a range from 12 to 10 doesn't seem so bad, an 11 inch measurement will give an odd result. (I admittedly didn't check against boundary condition.)
Hmm, not sure why it is not shown (to me), but I also wrote:
|
No, because that would potentially show very long stretches of road which would need to be split up. So, this would introduce possibly wrong data because the height restriction surely is not valid for the whole road/stretch but only for the area below the bridge. |
BTW: Some queries in maxheight map depend on extensive post processing. Using the query results as-is will not suffice in all cases. This is especially true for queries with intersection checks. Instead of adding data to the way, also existing nodes could be used for maxheight tags. This could avoid expensive splitting of roads. |
The estimate dialog could include the hint to take your own body height as a measure and estimate how many times you'd fit stacked on top of each other. Would that help you? As said, it should be an estimate only and clearly be tagged as such.
…On 9 March 2018 09:09:36 CET, Mateusz Konieczny ***@***.***> wrote:
matkoniecz commented on this pull request.
> +
+ @OverRide public AbstractQuestAnswerFragment createForm()
+ {
+ return new AddMaxHeightForm();
+ }
+
+ @OverRide public void applyAnswerTo(Bundle answer,
StringMapChangesBuilder changes)
+ {
+ boolean hasNoSign = answer.getBoolean(AddMaxHeightForm.NO_SIGN);
+ String maxheight = answer.getString(AddMaxHeightForm.MAX_HEIGHT);
+ if(hasNoSign)
+ {
+ /*TODO: maxheight=default or maxheight=no_sign?
+ according to
https://taginfo.openstreetmap.org/keys/maxheight#values
maxheight=no_sign is only used 14 times,
+ while maxheight=default is used about 10K times*/
+ changes.add("maxheight", "default");
> What is the information gain here?
I guess that in typical country it is mandatory to sign maxheight if it
is below some value (I would expect it to be chosen so normal-sized
vehicles can pass). So lack of sign indicates that normal vehicles can
pass trough. Also, with this it is always possible to tag something,
making this quest possible.
> about an estimate of the height and tag the estimate then
At least I am not really able to estimate height with any kind of
accuracy that would make worth tagging it.
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#960 (comment)
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
|
ping //cc: @slhh |
|
||
/*the query does not exclude elements which are not accessible by the public, | ||
because a maxheight sign will very probably be visible at the entrance or beginning*/ | ||
private static final String QUERY_RESTRICTIONS = "['maxheight'!~'.']['maxheight:physical'!~'.']"; |
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 can use !tag
instead of "tag"!~'.'
here : e.g. [!maxheight]
, or [!"maxheight:physical"]
If there is no sign, the user should be asked whether the physical height restricts any normal trafic including hgv. According to the answer we can tag:
|
HGV? |
Hgv : Heavy goods vehicle (LKW in deutsch) |
Ah, "truck".😌 |
Why should a surveyor who sees the bridge/tunnel in "real life" should not remember if he is standing right in front of it...? |
"This height looks implausible" message hides value entered by user, maybe it should be somehow displayed in a message? |
I would recommend excluding vehicle=private|no ways. I would recommend excluding also access=private|no ways. |
I would use no_sign as it is more clear what is really mapped. |
I see no justification for that - why it should be done? |
I would not, because this decreases the amount of solveable quest significantly. And very often the maxheight sign will be even displayed at the entrance of e.g. a parking |
Is it removing unwanted/pointless quests? If yes then I think that significant decrease makes it an even better idea. See cases like https://www.openstreetmap.org/way/518140477#map=19/50.07558/19.93155 or https://www.openstreetmap.org/way/295422615#map=19/50.05658/19.94075 What is the point of mapping maxheight restrictions for places inaccessible to general public? Owners of yard are not going to check maps/routing engines to check whatever they can access their own property. |
Well, that's true, but maybe there are some underground parkings which are not accessible by the general public but if you rent a parking space you can go in there... So there is not a single user but some more people who might be interested in using that data... |
So maybe keep
unchanged and add access filters for
? This should handle both cases. |
Good idea! I will do this. |
Don't think that this is necessary... The user will either remember the value he entered some moments ago or can simply press Cancel/I will check... |
… make DB actions involving single quests/elements synchronous again to simplify things
…n't limit at level 17.5) (streetcomplete#965)
whoops, did a rebase-merge instead of a normal merge. In case there will be problems when merging back to master, I will fix them. |
I tested this a bit, found this issue:
|
Hmm, regarding the Iceland-thing, it is weird. The LayoutInflater has the correct mcc-infused resources and selects the correct layout to inflate. Furthermore, it passes the same context to views it creates. For testing, I created a new view and included it in the layout.
So I am still in the dark as to why it does not work for that other view. |
Okay I found it. It is not easily solvable, as Google did not anticipate I guess that one would like to work with modified Resources: The workaround then is to manually set the resources again programmatically after inflation. |
Also, in regards to the earlier problem I noticed: When you write a dot instead of a comma on a non-English locale, the app crashes
Also, a feet has 12 inch. That means, that you should not be allowed to enter 12 inch, but at most 11. |
* make signs of height quest look-alike with speed quest and the other way round * adapt wording a little * add maxheight sign source svg
Although the measure_height_help image is gone from this PR, I have some feedback on it for when it next appears.
|
# Conflicts: # app/src/main/res/layout/activity_main.xml
Looks like this was an Android bug until Android O. Since this was only fixed then, we still need to workaround this. |
…o always be the "." for EditTexts with inputType "numberDecimal", independent of Locale. See https://issuetracker.google.com/issues/36907764
…t be confused whether he should use the one as displayed on the sign or in his phone's locale
Completed final tests |
Thank you very much for finishing this! 👍 🎉 I was really busy in the last days... |
You're welcome! But also, thank you of course for preparing this PR :-) |
This PR is a little bit more extensive... It adds a quest for determining the maximum height of e.g. tunnels or covered ways, parking entrances for underground and multi-storey parkings and of course height restrictors. It fixes #399, #421, #447.
Sorry for creating so many PRs in the last time, but I hope this helps to get the issue amount below 100 😄
Here are some things I have questions about:
Result: the measurement system is now stored in a new file. All countries and their units were checked while adding them.
maxheight=default
(used about 10K times) ormaxheight=no_sign
as proposed by the wiki but only used 14 times according to taginfo...see the source code for more information
Result: There is another menu for selecting the best fitting value
Result: don't add additional functionality because this might need some processing
.0
be added by SC? This is also the current behaviour...Result: Should not be added and removed
The quest looks like this in countries with the metric system known:
And this is how the quest will look like in countries with the imperial system
This is the current Overpass query: https://overpass-turbo.eu/s/wSP