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

Distinguish between villages/towns and country #692

Open
BigKananga opened this issue May 3, 2024 · 11 comments
Open

Distinguish between villages/towns and country #692

BigKananga opened this issue May 3, 2024 · 11 comments

Comments

@BigKananga
Copy link

Is it possible to distinguish between villages/towns and country? It would be very useful for my personal bicycle profile, because inside villages and small towns I prefer primary/secondary/teritary roads instead of many unnecessary turns on residential roads and smaller ways. Outside towns I prefer tracks and paths/cycleways of course. I use trekking profile as base.

@quaelnix
Copy link
Collaborator

quaelnix commented May 5, 2024

As far as villages/cities are concerned, you can try your luck with the newly introduced estimated_town_class tag.

However, be prepared for a lot of frustration, as the logic behind the creation of these new pseudo tags is unfortunately not very sophisticated, which results in a very high rate of false positives and false negatives.

instead of many unnecessary turns on residential roads and smaller ways.

You can assign different turncost values for different types of ways.


I don't know of any good way to distinguish between different countries.

@BigKananga
Copy link
Author

BigKananga commented May 5, 2024

As far as villages/cities are concerned, you can try your luck with the newly introduced estimated_town_class tag.

However, be prepared for a lot of frustration, as the logic behind the creation of these new pseudo tags is unfortunately not very sophisticated, which results in a very high rate of false positives and false negatives.

I see this in trekking profile, but I don't know what is estimated_town_class 1 for example. Is there any explanation? Even in profile developer guide I didn't find anything.

You can assign different turncost values for different types of ways.
This is also in trekking profile and therefore I added this line:
else if highway=residential then 200

This seems to work better for me. But I'd prefer different rules for villages/towns and rural.

@quaelnix
Copy link
Collaborator

quaelnix commented May 6, 2024

Is there any explanation?

As far as documentation goes, this is all we have at the moment: Environmental considerations

what is estimated_town_class 1 for example

In short: All ways within the OpenStreetMap administrative boundaries of cities with a population between 50,000 and 80,000 inhabitants are assigned the tag estimated_town_class=1 when the map is created. But not the ways that are close to something green (forests, parks, playgrounds, ...) and not the ways that are close to something blue (rivers, lakes, ponds, ...). So if you are trying to take advantage of this tag, keep the following in mind:

  • Ways through agricultural land that lie within the administrative boundaries of such towns are tagged with estimated_town_class=1, even if the nearest road or house is kilometers away.
  • Ways through the administrative boundaries of towns with less than 50,000 inhabitants will not be tagged at all.
  • Many ways inside of very big towns will not be tagged because of the 'green' and 'blue' exclusion logic

You can visualize the new pseudo tags to some extent with this tool: https://brouter.de/brouter-web/PseudoTags.html

@BigKananga
Copy link
Author

Thanks! I think estimated_town_class isn't the right one for my intention. I'm talking about places with much less than 50k inhabitants, mainly from 1.000 to 20.000. And since every area is also within an (large) administrative boundary, it won't be useful for my intention. I'd need something based on landuse=residential or landuse=industrial and so on. Ways within these areas (or not within) would be interesting to distinguish.

@EssBee59
Copy link
Collaborator

EssBee59 commented May 8, 2024

Hello BigKanaga,

I think, your question is strange for a trekking profile. I had similar thought for my racebike profile...
But I wil try to help:
First, I think it is not the best idea to base your profile on the standard trekking profile as I see many issues and weakness in it.
As example, it do not use the "maxspeed" tag, that can be really helpfull in your case, at least in countries where OSM is well maintained (as in Germany)
Where Maxspeed <= 50 you are probably in a urban area!
Further usable tags:

  • estimated_town_tags; if the tag is not defined on the highway you are not in a big town or city
  • estimated_traffic_class should also help to control the routing on primary/secondary/tertiary

As I was not happy with the standard profiles, I also created my own profiles that you can use in my instance:
Trekking_SB
https://brouter.de/essbee/#map=12/49.9775/9.2089/osm-mapnik-german_style&profile=trekking_SB

Racebike-verylowtrafic
https://brouter.de/essbee/#map=12/49.9775/9.2089/osm-mapnik-german_style

Regards

@quaelnix
Copy link
Collaborator

quaelnix commented May 9, 2024

it is not the best idea to base your profile on the standard trekking profile as I see many issues and weakness in it.

And yet it comes much closer to what @BigKananga seeks for:

Trekking (link to route) Trekking SB (link to route)

@BigKananga
Copy link
Author

Hello EssBee59,

thanks for your input!
I think trekking is the nearest of the available profiles that fit to my ideas. If I try fastbike or velobike in BRouter web, cycleways are not used between villages for example. So trekking is just a base for me since none of BRouter webs profiles satisfied me.
Maxspeed is an interesting tag, so I (in Germany) will think about if I could integrate it.

Big towns like estimated_town_tags aren't relevant for me. In estimated_traffic_class I see the huge disadvantage, that it doesn't distinguish between villages/towns and rural. So if i'd focus on primary/secondary/tertiary I'd automatically focus on them between villages and that's the opposite of my goal. Maxspeed could help more.

I tested both of your profiles. In most parts they seem to be better than the included profiles, but they also don't satisfy me. There is too many confusing routing with some heavy detours with lots of unneccessary turns in villages.

With some adjustments I got a profile now that seem to work fine for me. One important thing was turncost, another important one were some values that I changed. Until now it's ok, but it's only a workaround. The use of something like landclasses would be more reliable. I'll do some fine tuning and I think I'm on a good way.

Some small offtopic: I've got 2 Android devices. One with Android 9 (LineageOS) and one with Android 13 (security patch from 1. April. 2024. On the first one everything works fine. On the second one I can't access the BRouter folder on the SD card with my file manager (sadly one security "feature" of Android). So I copied my profile on my Windows PC but it won't be recognized by BRouter. As mentioned, on my Android 9 device it works fine. Is there any chance to get my custom profile working?
If you want I can open a new topic of course.

@EssBee59
Copy link
Collaborator

EssBee59 commented May 10, 2024

Is there any chance to get my custom profile working?

Hello,
Since 2 or 3 years "intend" is supported by the brouter-app.
So if you get your profile on the smartphone (via mail, messenger, BT, or ..) double click on it and open with the brouter-web app.
The profile is imported into the brouter-app and is ready for use!

An other solution to bypass the new security in Android:
Install the app-data in /android/media, not in /android/data

@quaelnix
Copy link
Collaborator

Maxspeed is an interesting tag, so I (in Germany) will think about if I could integrate it.

In estimated_traffic_class I see the huge disadvantage, that it doesn't distinguish between villages/towns and rural.

You could try this to get a bool value that tells you whether or not a road likely fits your demands:

assign probablygood and ( maxspeed=10|20|30|40|50 ) ( not estimated_traffic_class=5|6|7 )

And then adjust the cost factor in the trekking or trekking-ignore-cr profiles as follows:

else if ( highway=primary|primary_link ) then ( if isbike then 1.2 else 3 )
else if ( highway=secondary|secondary_link ) then ( if isbike then 1.1 else 1.6 )
else if ( highway=tertiary|tertiary_link ) then ( if isbike then 1.0 else 1.4 )
else if ( highway=unclassified ) then ( if isbike then 1.0 else 1.3 )

->

  else if ( highway=primary|primary_link     ) then ( if isbike then 1.2 else switch probablygood 1.3 3  )
  else if ( highway=secondary|secondary_link ) then ( if isbike then 1.1 else switch probablygood 1.2 1.6 )
  else if ( highway=tertiary|tertiary_link   ) then ( if isbike then 1.0 else switch probablygood 1.1 1.4 )
  else if ( highway=unclassified             ) then ( if isbike then 1.0 else switch probablygood 1.1 1.3 )

But this will obviously only work realiably if all segments of major roads in the respective village or town carry a maxspeed tag, which is rarely the case even in Germany. But it might still improve the route results on average.

Big towns like estimated_town_tags aren't relevant for me.

Yes, and I really hope that one day we (the developers) will agree that it would make a lot of sense to change the tag generation logic to properly address problems like the ones you have.

@BigKananga
Copy link
Author

@EssBee59
Thanks, importing worked fine.

@quaelnix
I did it in this way:
assign max_outside_town and maxspeed=30|40|50 not estimated_town_class=1|2|3|4|5|6
This is for (primary/secondary/tertial) roads inside villages only because I realized that it makes also sense for me to distinguish between towns (in my case a 300k town) and villages, because these road types have more traffic in towns. With estimated_traffic_class I'll distinguish these 3 road types also in towns.

I'm tweaking now the the config with playing around with the values and trying a bunch of routes (from-to) where I can judge which routes would be fine for me. In the past (with default profiles) many times I had to add several intermediate goals, but now it seems that I don't need them anymore. Alt least regularly.

BTW: One very important tweak was to set "ignore_cycleroutes" to "true", because with "false" routing tends to ridiculous detours with many turns just to be on a cycleroute even if it's only for 100m. If you ask me, it should be set to "true" by default and "trekking-ignore-cr" should be replaced by something like "trekking-prefer-cr" where it is set to "false" by default (-> just rename both profiles). If someone wants to follow cycleroutes, they can be shown as an overlay in Osmand and therefore I doubt that navigation is always needed. And most users will use default profile.
And I think it would be better if "cr" would be "cycleroutes", because not everyone (including me) knows the meaning of "cr" immediately.

All in all BRouter is a fantastic tool and probably the best navigation for bicycles, especially offline. Thanks to all developers!

@BigKananga
Copy link
Author

Some small offtopic: I've got 2 Android devices. One with Android 9 (LineageOS) and one with Android 13 (security patch from 1. April. 2024. On the first one everything works fine. On the second one I can't access the BRouter folder on the SD card with my file manager (sadly one security "feature" of Android). So I copied my profile on my Windows PC but it won't be recognized by BRouter. As mentioned, on my Android 9 device it works fine. Is there any chance to get my custom profile working? If you want I can open a new topic of course.

Now I got it. I used my "old" micro SD from my old Android 8 device in my new Android 13 device. On the new device Brouter is using the media folder while the old one used the data folder. I realized it when I checked the dates from my downloaded segment. This happens when you try to use your old data on a new device. :)

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

No branches or pull requests

3 participants