Re: [OSRM-talk] Small ways get small speeds

2018-03-02 Thread Daniel Patterson
Hi François,

  No, we likely won't change the storage precision any time soon.
OpenStreetMap itself only stores

Here is the constant that OSRM uses to store lon/lat decimal values in
integer format:
https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp#L44

We multiply the lon/lat decimal by 1e6 (100), then store just the
integer part. This is equivalent to about 10cm precision at the equator.

*HOWEVER* you can't just change this without also updating the coordinate
vector packing.  It's not a simple change.

OpenStreetmap stores 1 additional decimal place, in the same way (database
stores integers).  Here are the code references.

https://github.com/openstreetmap/openstreetmap-website/blob/master/db/structure.sql#L353-L354
https://github.com/openstreetmap/openstreetmap-website/blob/396f2e28dd27d514f7882c3918103b12764038de/lib/geo_record.rb#L17-L20

Increasing OSRM's storage to match OSM would require more memory usage, and
little obvious gain.

daniel


On Fri, Mar 2, 2018 at 2:57 AM, François Lacombe 
wrote:

> Hi Daniel,
>
> Thank you for answer
> I understand well the issue here
>
> Would it be acceptable to specify coordinates storage precision in a next
> release ?
>
> Nevertheless, I got that it won't impact a lot my routing results.
>
> All the best
>
> François
>
> 2018-02-28 20:37 GMT+01:00 Daniel Patterson :
>
>> Hi François,
>>
>>   What you are seeing is rounding error.
>>
>>   Internally, OSRM only stores the "duration" of each segment, with a
>> resolution of 0.1 seconds.  On the map, the speed is calculated by taking
>> the length of the segment, and dividing it by the "duration" value.
>>
>>   We store longitude/latitude to 6 decimal places, so they have
>> approximately 10cm precision (https://en.wikipedia.org/wiki
>> /Decimal_degrees) depending on your latitude.  This precision means that
>> calculating the length of a segment is limited to +/- approx 10cm precision
>> as well.
>>
>>   Both of these precision limits compound for short segments when
>> displayed on the map, and sometimes the speed values look weird.
>>
>>   However, they do not affect route selection very much, because routing
>> is done by accumulating time, and short segments generally only add small
>> amounts of time to the routing decision.
>>
>> daniel
>>
>>
>>
>> On Wed, Feb 28, 2018 at 10:41 AM, François Lacombe <
>> fl.infosrese...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> While investigating for flaws in a custom profile I'm trying to write, I
>>> discovered that arbitrary small ways got strange speed regarding the rules
>>> I used.
>>>
>>> Here is an extract from osrm-frontend debug
>>> https://imgur.com/a/L8coz
>>>
>>> All segments on the red line have the same attributes.
>>> I don't understand why the small parts in the middle got really slower
>>> speed than the longer ones.
>>> Do you have any idea?
>>>
>>> The purple road with 0km/h speed is normal and expected.
>>>
>>>
>>> Thank you for any hint
>>>
>>> Thanks in advance
>>>
>>> François
>>>
>>> ___
>>> OSRM-talk mailing list
>>> OSRM-talk@openstreetmap.org
>>> https://lists.openstreetmap.org/listinfo/osrm-talk
>>>
>>>
>>
>> ___
>> OSRM-talk mailing list
>> OSRM-talk@openstreetmap.org
>> https://lists.openstreetmap.org/listinfo/osrm-talk
>>
>>
>
> ___
> OSRM-talk mailing list
> OSRM-talk@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
>
___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


Re: [OSRM-talk] Small ways get small speeds

2018-02-28 Thread Daniel Patterson
Hi François,

  What you are seeing is rounding error.

  Internally, OSRM only stores the "duration" of each segment, with a
resolution of 0.1 seconds.  On the map, the speed is calculated by taking
the length of the segment, and dividing it by the "duration" value.

  We store longitude/latitude to 6 decimal places, so they have
approximately 10cm precision (https://en.wikipedia.org/wiki/Decimal_degrees)
depending on your latitude.  This precision means that calculating the
length of a segment is limited to +/- approx 10cm precision as well.

  Both of these precision limits compound for short segments when displayed
on the map, and sometimes the speed values look weird.

  However, they do not affect route selection very much, because routing is
done by accumulating time, and short segments generally only add small
amounts of time to the routing decision.

daniel



On Wed, Feb 28, 2018 at 10:41 AM, François Lacombe <
fl.infosrese...@gmail.com> wrote:

> Hi,
>
> While investigating for flaws in a custom profile I'm trying to write, I
> discovered that arbitrary small ways got strange speed regarding the rules
> I used.
>
> Here is an extract from osrm-frontend debug
> https://imgur.com/a/L8coz
>
> All segments on the red line have the same attributes.
> I don't understand why the small parts in the middle got really slower
> speed than the longer ones.
> Do you have any idea?
>
> The purple road with 0km/h speed is normal and expected.
>
>
> Thank you for any hint
>
> Thanks in advance
>
> François
>
> ___
> OSRM-talk mailing list
> OSRM-talk@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/osrm-talk
>
>
___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


[OSRM-talk] Small ways get small speeds

2018-02-28 Thread François Lacombe
Hi,

While investigating for flaws in a custom profile I'm trying to write, I
discovered that arbitrary small ways got strange speed regarding the rules
I used.

Here is an extract from osrm-frontend debug
https://imgur.com/a/L8coz

All segments on the red line have the same attributes.
I don't understand why the small parts in the middle got really slower
speed than the longer ones.
Do you have any idea?

The purple road with 0km/h speed is normal and expected.


Thank you for any hint

Thanks in advance

François
___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk