Comments (11)
Judging from the values on the taginfo website, we should probably increase the size of the encoded value to 9 bits:
https://taginfo.openstreetmap.org/keys/maxweight#values
A maximum value of 0.1 * 2^9 = 51,2
would cover the heaviest trucks in Europe and most of the USA.
The alternative approach of increasing the factor to 0.2
, 0.3
or 0.5
causes us to lose precision for frequently used values. e.g:
Value / Factor | 0.1 | 0.2 | 0.5 |
---|---|---|---|
3.5 | x | x | |
2.8 | x | x | |
51.4 | x | x | |
6000lbs (~2.72) | (x) |
from graphhopper.
Is it really a good idea to silently cap values here?
I'd argue that we should treat "overflows" the same way as deliberately passing Double.POSITIVE_INFINITY:
if (useMaximumAsInfinity && value >= maxStorableValue * factor) {
super.setInt(reverse, edgeId, edgeIntAccess, maxStorableValue);
return;
}
This would also restore symmetry with DecimalEncodedValue.getNextStorableValue(double)
which also returns Double.POSITIVE_INFINITY in this case.
See #2990
from graphhopper.
@karussell we can also stick with 8 bits and try to map the values as an enum instead. With 256 possible values, we should be able to cover all common limitations in the source material. The downside, of course, is that an enum is a single point of failure and would need to be evaluated from time to time.
from graphhopper.
try to map the values as an enum instead
But then it can no longer be (easily) used as a number in a custom model (?)
from graphhopper.
Agreed. Let's roll with 9bits 🙂
from graphhopper.
There is still the idea of a "Mapped"EncodedValue, i.e. instead of a factor it holds only distinct values. This could be interesting for a couple of EncodedValues as it could be still used as a number. The tricky thing could be the rounding.
from graphhopper.
The tricky thing could be the rounding.
I'd search the value with a configurable epsilon per EV.
from graphhopper.
What I meant is if you have the values and some with a bigger gap like: 3, 4, 10, 27. Then the value 20 should be rounded up to 27 but this would be IMO against the conservative approach and a vehicle of weight 22 would pass although it shouldn't. So, it might be necessary to implement different rounding strategies or something.
from graphhopper.
It's also tricky from a maintenance perspective. How do we know if we're missing a popular value? We would need to keep track of all the variants and how often they occur during import to be able to provide meaningful logging.
from graphhopper.
Yes, sounds tricky. We could collect this information directly in the encoded value and then after "graph.freeze" decide on how to best use the available bits. We could limit the values to 100 * available values
and throw out less frequent values while the import to avoid a memory problem. But not sure how feasible this is.
from graphhopper.
private static final Map<Double,Integer> ENCOUNTERED_VALUES = new LinkedHashMap<>() {
@Override
protected boolean removeEldestEntry(Map.Entry<Double, Integer> eldest) {
return size() > 10_000;
}
};
// ...
ENCOUNTERED_VALUES.compute(value, (k, v) -> v == null ? 1 : v + 1);
Edit: If we want to only log offending ones
from graphhopper.
Related Issues (20)
- Route: Legs information empty in Java API
- Isochrone: No buckets when using public transport
- I just finished translating all zh_CN & zh_HK HOT 1
- Default bicycle profile ignoring turn restrictions? HOT 2
- Tags vehicle=no + bicycle:conditional=yes@… should trigger warning instead of failing to route in cycle profiles HOT 3
- Bike priority determination problem for tag combination of `cycleway:left` and `cycleway:right`
- GHUtility's method not found
- LMApproximator overhead HOT 3
- Benchmark stops with PointOutOfBoundsException HOT 5
- make `edges` byte-based
- highway=cycleway + access=no + bicycle=NULL is used for routing HOT 7
- should locked=yes have lower priority? HOT 11
- bad u-turn on road with turn restriction HOT 4
- correctness vs. speed: astarbi.epsilon
- Snapping to turn restriction via-edges yields bad routes HOT 2
- bike should better avoid primary roads HOT 1
- bike should preffer more footways with bicycle=yes HOT 5
- Allow to route through highway=construction HOT 8
- curve di livello sparite dalle piantine altimetriche, così pure la nomenclatura dei luoghi HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphhopper.