Re: [OSRM-talk] Road speeds and profile restrictions

2015-09-21 Thread Richard Marsden
Thanks - yes the visitor initally looked a bit complicated, but I
think your example will help.

C++: not necessarily, but I don't particularly like Javascript, so
I've never taken to Node.js! Javascript is a necessary evil on the
client, but speaking generally, I think there are usually many better
choices for the server. Granted, C++ probably wouldn't be one of
those.


Richard

On Mon, Sep 21, 2015 at 3:12 PM, Patrick Niklaus
 wrote:
> For an example on how to use the visitor:
>
> https://github.com/Project-OSRM/node-osrm/blob/master/src/json_v8_renderer.hpp
>
> This is what directly transforms our on variant in the v8 object
> model. You can use it to transform it back to any data structure that
> you need.
>
> BTW. Is using the C++ interface a requirement for you? Using the node
> bindings is in general much more convenient. The speed is close to
> what you would get with C++ and is generally more suited for
> server-side code.
>
>
> On Mon, Sep 21, 2015 at 6:50 PM, Richard Marsden  wrote:
>> Thanks, yes that got it working with mapbox::util::get, eg:
>>
>> double v = mapbox::util::get( (it->second) ).value;
>>
>> Okay this is for the status which is an integer, so it should be
>> rounded (and should be either 0 or 207).
>>
>> dusting off my C++, I've already upgraded my Stroustrup from a
>> battered 2nd edition to the latest 4th edition. Seems like I need to
>> catch up on boost, as well :-)
>>
>> Richard
>>
>>
>> On Mon, Sep 21, 2015 at 10:14 AM, Richard Marsden  wrote:
>>> Thanks - yes, I'd found the definition of osrm::json::Object and
>>> osrm::json::Value, and went through quite a few variations. I'll have
>>> a look at the boost variant definition.
>>>
>>> I didn't know my C++ was so rusty until I tried working with OSRM! I
>>> used to use it a lot, but it was before boost came along.
>>>
>>> richard
>>>
>>> On Mon, Sep 21, 2015 at 7:15 AM, Daniel Hofmann  wrote:
 First of all, don't use C-style casts, a la `(int)myObject;` as this will
 (in the worst case) degrade to a `reinterpret_cast` and you really don't
 want this behavior.

 Now take a look here:
>
> https://github.com/Project-OSRM/osrm-backend/blob/e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1/include/osrm/json_container.hpp#L84-L87

 This is the definition of `osrm::json::Object`. Above it you find the
 definition of `osrm::json::Value`, which is a heterogeneous sum type, 
 making
 use of the following implementation:
> https://github.com/mapbox/variant

 And here is the basic hello world example for the variant implementation:
>
> https://github.com/mapbox/variant/blob/bf485dfb59aef26f3ef2183d7c8cad97062b/test/variant_hello_world.cpp

 Because it mimics Boost.Variant, please have a look at the detailed 
 tutorial
 here:
> http://www.boost.org/doc/libs/1_59_0/doc/html/variant/tutorial.html

 It shows you among other things how to use the double dispatch visitor
 pattern for extracting values from a variant.

 Hope that helps,
 Daniel

 On Sun, Sep 20, 2015 at 8:20 PM, Richard Marsden  wrote:
>
> Steve how did you extract information from the osrm::json::Object
> returned object?
> I could covert the Object to string, and then parse it with a 3rd
> party JSON library, but that seems long-winded.
> I've already asked this question on the OSM Q&A site but no anwers yet:
>
>
> https://help.openstreetmap.org/questions/45342/extracting-data-values-from-osrms-osrmjsonobject-using-c
>
> Text of question:
>
> I can receive the JSON result successfully and printing it to the
> console (as per the online samples), but I am have problems extracting
> actual field data. How can I extract individual fields as numbers,
> string, etc?
>
> I've tried various forms of casting, but this is what I have at the
> moment (trying to extract the status value):
>
> const int gr_result_code = routing_machine.RunQuery(route_parameters,
> json_result);
> std::string sStat("status");
> auto it = json_result.values.find(sStat);
> osrm::json::Number vv =  (osrm::json::Number) ((*it).second); // doesn't
> compile
> int v = (int) (vv.value); // probably some dodgy rounding here
>
> The Number casting is producing compiler errors. I guess I could
> convert the object to a string, and then using a third party JSON
> parser to extract individual fields, but this seems very wasteful.
>
>
> 
> Richard
>
> On Thu, Sep 17, 2015 at 8:20 PM, Stephen Woodbridge
>  wrote:
> > Richard,
> >
> > I have already imbedded OSRM into a C++ application and in fact wrapped
> > that
> > application into a postgresql database extension. I my case I only need
> > data
> > for a city but I was making literally billions of calls to osrm.
> >
> > As Patrick said, OSRM ma

Re: [OSRM-talk] osrm rail extract & lua content

2015-09-21 Thread Luc Van Linden
Hi Patrick

Thanks for your input.
The ambition as such is not to perform railway routing as such, just to get
an understanding on how to take a class subset into account for profile.lua
file.

In other words, suppose we only want to perform routing using the moterways
only explicitly (thus have only the motorways in the graph).
What are actually the statements in the lua file which will select only
those osm ways to be incorporated in the osrm graph?


tx

Luc






On Mon, Sep 21, 2015 at 10:20 PM, Patrick Niklaus <
patrick.nikl...@student.kit.edu> wrote:

> That profile is very much outdated. Note the year of the post: 2013.
>
> Try to copy the current car.lua and strip it down. You should be able
> to adapt this profile easily. That said: OSRM is _really_ not suited
> for railway routing:
>
> 1. We don't support time table based routing (e.g. there is not 'time'
> in OSRMs data model)
> 2. There is nothing stoping OSRM from computing impossible train
> connections that require changing the train 10 times
> 3. For good train routing you would want to integrate multi-modal
> routing (e.g. connect  train stations by foot paths) which is also
> hard with OSRM
>
>
>
> On Mon, Sep 21, 2015 at 6:32 PM, Luc Van Linden 
> wrote:
> > Hi
> >
> > We have been trying to test OSRM on the railway lines in Belgium. (on
> > windows using the windows binary builds)
> >
> > The full belgian osm file works with the standard profile.lua  (car
> > profile). We can run extract, prepare and run.
> >
> > When we try to use a railway profile, osrm.extract stops working.
> >
> > We have used the following thread without succes:
> >
> > https://www.mail-archive.com/osrm-talk@openstreetmap.org/msg00320.html
> >
> > So not clear if we have sufficient things covered in the lua file for the
> > extract.
> >
> > tx
> >
> >
> > Luc
> >
> > ___
> > 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] osrm rail extract & lua content

2015-09-21 Thread Patrick Niklaus
That profile is very much outdated. Note the year of the post: 2013.

Try to copy the current car.lua and strip it down. You should be able
to adapt this profile easily. That said: OSRM is _really_ not suited
for railway routing:

1. We don't support time table based routing (e.g. there is not 'time'
in OSRMs data model)
2. There is nothing stoping OSRM from computing impossible train
connections that require changing the train 10 times
3. For good train routing you would want to integrate multi-modal
routing (e.g. connect  train stations by foot paths) which is also
hard with OSRM



On Mon, Sep 21, 2015 at 6:32 PM, Luc Van Linden  wrote:
> Hi
>
> We have been trying to test OSRM on the railway lines in Belgium. (on
> windows using the windows binary builds)
>
> The full belgian osm file works with the standard profile.lua  (car
> profile). We can run extract, prepare and run.
>
> When we try to use a railway profile, osrm.extract stops working.
>
> We have used the following thread without succes:
>
> https://www.mail-archive.com/osrm-talk@openstreetmap.org/msg00320.html
>
> So not clear if we have sufficient things covered in the lua file for the
> extract.
>
> tx
>
>
> Luc
>
> ___
> 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] character length of route geometry

2015-09-21 Thread Patrick Niklaus
No, but there is simplification applied if you specify the `z` parameter.

On Mon, Sep 21, 2015 at 10:06 PM, Alex Farioletti  wrote:
> is there a max character length of route geometries?
>
>
> Alex Farioletti
> 415.312.1674
> tcbcourier.com
>
> ___
> 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] osrm extract on a osm file created using a using BBox query

2015-09-21 Thread Luc Van Linden
Hi Daniel

Thanks for your feedback. We used a new BBquery this time using osmosis.
With JOSM we can check dat this export is actually following the approach
you suggested.

The extract is ok now.

It is the prepare that is failing.

[info] Input file: Oudenaarde_BB.osrm←[0m
[info] Restrictions file: Oudenaarde_BB.osrm.restrictions←[0m
[info] Profile: profile.lua←[0m
[info] Threads: 4←[0m
[info] Generating edge-expanded graph representation←[0m
[info]  - 13 restrictions.←[0m
[info] Importing n = 39160 nodes ←[0m
[info]  - 3 bollard nodes, 6 traffic lights←[0m
[info]  and 40510 edges ←[0m
[info] Graph loaded ok and has 40510 edges←[0m

Then a windows box says the osrm.prepare has stopped working.

The JOSM tools mentioned that a couple of relations are incomplete:

1 restriction and a series of routes.

using

use_turn_restrictions   = false
or
use_turn_restrictions   = true

in the profile does not make any difference the extract works in both cases
the prepare fails as described above.

Now for the time being there is no need to spent to much time on this
subject as the standard profile.lua extract/prepare/run works fine and fast
even on the full Belgian country.

We ran into this issue as we read a lot to take an extract to test
profiling.

Btw we tested this on the windows build from july and august.

We will try the latest.

Our major concern and issues we currently are facing is to get a better
understanding on the profile.lua config.
As written in our other post, we would like to understand to actually limit
the graph as such, by exmplae performing teh extract/prepare/run work for
only railwaylines as a test case.

Thanks again.

Luc







On Mon, Sep 21, 2015 at 7:18 PM, Daniel Hofmann  wrote:

> Down-sizing files with bounding-box queries is dangerous when not
> carefully executed.
>
> We had similar issues a few month ago that went like this:
>
> When you do a simple bounding-box query, you do a hard cut through way
> nodes at the borders, resulting in dangling node references in the OSM file.
>
> What you instead have to do is the following:
>
> - query for all nodes in your bounding-box
> - query for the associated ways for those nodes
> - now run through those ways and return all the way nodes
>
> now your ways no longer have dangling references.
>
> There is a tool to check for dangling references, `osmium check-refs`:
> >
> http://gis.19327.n5.nabble.com/Referential-Integrity-Problem-td5848030.html#a5848890
>
> Which OSRM version are you on? I thought we made the dangling reference
> issues harder to crash OSRM and instead throwing and error. Could you try
> with the latest 4.8.1 release please?
>
> On Mon, Sep 21, 2015 at 5:06 PM, Luc Van Linden 
> wrote:
>
>> Hi
>>
>> We are currently testing the usage of OSRM (on windows using the
>> published binaries) and the way the profile.lua file needs to be configured
>> to minimise the resulting graph.
>>
>> We would like to understand which part of the lua file will actually
>> "decide" if a specific element/tag/way is included in the graph.
>>
>> We have tested with afull belgian coverage. The standard profile.lua file
>> works for extract/prepare and run.
>>
>> However when we use a small but substantial relevant subset of Belgium,
>> using a BBOX, osrm_extract fails. A windows messagebox pops up, just a
>> message saying the program osrm.extract has stopped working.
>>
>> This is the console output:
>>
>> [info] Input file: belgium-latest.osm.pbf←[0m
>> [info] Profile: profile.lua←[0m
>> [info] Threads: 4←[0m
>> [info] Using script profile.lua←[0m
>> [STXXL-MSG] STXXL v1.4.99 (prerelease/Release) (git
>> f7389c79e946430f5e3f7efc15e5
>> bcc29183d200) + gnu parallel(__GLIBCXX__)
>> [STXXL-MSG] Disk 'd:\temp\stxxl' is allocated, space: 1 MiB, I/O
>> implementat
>> ion: wincall queue=0 devid=0
>> [info] Parsing in progress..←[0m
>> [info] input file generated by Osmium (
>> http://wiki.openstreetmap.org/wiki/Osmium
>> )←[0m
>> [info] timestamp: 2015-07-13T21:15:02Z←[0m
>> [info] Ignoring turn restrictions←[0m
>>
>>
>> - is there somewhre a log file we can check?
>> - does osrm.extract expect all info to be available? I can image that the
>> BBox rectangle extract might be missing some nodes or other elements in
>> routes/restrictions etc?
>> - more generic, what is the information osrm.extract is expecting in an
>> osm file?
>>
>> thanks
>>
>> Luc
>>
>>
>>
>>
>>
>> ___
>> 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] Road speeds and profile restrictions

2015-09-21 Thread Patrick Niklaus
For an example on how to use the visitor:

https://github.com/Project-OSRM/node-osrm/blob/master/src/json_v8_renderer.hpp

This is what directly transforms our on variant in the v8 object
model. You can use it to transform it back to any data structure that
you need.

BTW. Is using the C++ interface a requirement for you? Using the node
bindings is in general much more convenient. The speed is close to
what you would get with C++ and is generally more suited for
server-side code.


On Mon, Sep 21, 2015 at 6:50 PM, Richard Marsden  wrote:
> Thanks, yes that got it working with mapbox::util::get, eg:
>
> double v = mapbox::util::get( (it->second) ).value;
>
> Okay this is for the status which is an integer, so it should be
> rounded (and should be either 0 or 207).
>
> dusting off my C++, I've already upgraded my Stroustrup from a
> battered 2nd edition to the latest 4th edition. Seems like I need to
> catch up on boost, as well :-)
>
> Richard
>
>
> On Mon, Sep 21, 2015 at 10:14 AM, Richard Marsden  wrote:
>> Thanks - yes, I'd found the definition of osrm::json::Object and
>> osrm::json::Value, and went through quite a few variations. I'll have
>> a look at the boost variant definition.
>>
>> I didn't know my C++ was so rusty until I tried working with OSRM! I
>> used to use it a lot, but it was before boost came along.
>>
>> richard
>>
>> On Mon, Sep 21, 2015 at 7:15 AM, Daniel Hofmann  wrote:
>>> First of all, don't use C-style casts, a la `(int)myObject;` as this will
>>> (in the worst case) degrade to a `reinterpret_cast` and you really don't
>>> want this behavior.
>>>
>>> Now take a look here:

 https://github.com/Project-OSRM/osrm-backend/blob/e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1/include/osrm/json_container.hpp#L84-L87
>>>
>>> This is the definition of `osrm::json::Object`. Above it you find the
>>> definition of `osrm::json::Value`, which is a heterogeneous sum type, making
>>> use of the following implementation:
 https://github.com/mapbox/variant
>>>
>>> And here is the basic hello world example for the variant implementation:

 https://github.com/mapbox/variant/blob/bf485dfb59aef26f3ef2183d7c8cad97062b/test/variant_hello_world.cpp
>>>
>>> Because it mimics Boost.Variant, please have a look at the detailed tutorial
>>> here:
 http://www.boost.org/doc/libs/1_59_0/doc/html/variant/tutorial.html
>>>
>>> It shows you among other things how to use the double dispatch visitor
>>> pattern for extracting values from a variant.
>>>
>>> Hope that helps,
>>> Daniel
>>>
>>> On Sun, Sep 20, 2015 at 8:20 PM, Richard Marsden  wrote:

 Steve how did you extract information from the osrm::json::Object
 returned object?
 I could covert the Object to string, and then parse it with a 3rd
 party JSON library, but that seems long-winded.
 I've already asked this question on the OSM Q&A site but no anwers yet:


 https://help.openstreetmap.org/questions/45342/extracting-data-values-from-osrms-osrmjsonobject-using-c

 Text of question:

 I can receive the JSON result successfully and printing it to the
 console (as per the online samples), but I am have problems extracting
 actual field data. How can I extract individual fields as numbers,
 string, etc?

 I've tried various forms of casting, but this is what I have at the
 moment (trying to extract the status value):

 const int gr_result_code = routing_machine.RunQuery(route_parameters,
 json_result);
 std::string sStat("status");
 auto it = json_result.values.find(sStat);
 osrm::json::Number vv =  (osrm::json::Number) ((*it).second); // doesn't
 compile
 int v = (int) (vv.value); // probably some dodgy rounding here

 The Number casting is producing compiler errors. I guess I could
 convert the object to a string, and then using a third party JSON
 parser to extract individual fields, but this seems very wasteful.


 
 Richard

 On Thu, Sep 17, 2015 at 8:20 PM, Stephen Woodbridge
  wrote:
 > Richard,
 >
 > I have already imbedded OSRM into a C++ application and in fact wrapped
 > that
 > application into a postgresql database extension. I my case I only need
 > data
 > for a city but I was making literally billions of calls to osrm.
 >
 > As Patrick said, OSRM makes random access calls to memory and there are
 > a
 > lot of variables that come into play like how well the data is clustered
 > in
 > memory pages, how many page faults you hit, etc. For your specific use
 > case
 > no one will have a good answer for you and you really need to do some
 > performance testing using the product the way you intend it to be used
 > and
 > see what the performance issues are. Maybe you use case is fine. The
 > OSRM
 > public service uses lots of memory because it has to support multiple
 > ran

[OSRM-talk] character length of route geometry

2015-09-21 Thread Alex Farioletti
is there a max character length of route geometries?


*Alex Farioletti*
*415.312.1674*
*tcbcourier.com  *
___
OSRM-talk mailing list
OSRM-talk@openstreetmap.org
https://lists.openstreetmap.org/listinfo/osrm-talk


Re: [OSRM-talk] osrm extract on a osm file created using a using BBox query

2015-09-21 Thread Daniel Hofmann
Down-sizing files with bounding-box queries is dangerous when not carefully
executed.

We had similar issues a few month ago that went like this:

When you do a simple bounding-box query, you do a hard cut through way
nodes at the borders, resulting in dangling node references in the OSM file.

What you instead have to do is the following:

- query for all nodes in your bounding-box
- query for the associated ways for those nodes
- now run through those ways and return all the way nodes

now your ways no longer have dangling references.

There is a tool to check for dangling references, `osmium check-refs`:
>
http://gis.19327.n5.nabble.com/Referential-Integrity-Problem-td5848030.html#a5848890

Which OSRM version are you on? I thought we made the dangling reference
issues harder to crash OSRM and instead throwing and error. Could you try
with the latest 4.8.1 release please?

On Mon, Sep 21, 2015 at 5:06 PM, Luc Van Linden 
wrote:

> Hi
>
> We are currently testing the usage of OSRM (on windows using the published
> binaries) and the way the profile.lua file needs to be configured to
> minimise the resulting graph.
>
> We would like to understand which part of the lua file will actually
> "decide" if a specific element/tag/way is included in the graph.
>
> We have tested with afull belgian coverage. The standard profile.lua file
> works for extract/prepare and run.
>
> However when we use a small but substantial relevant subset of Belgium,
> using a BBOX, osrm_extract fails. A windows messagebox pops up, just a
> message saying the program osrm.extract has stopped working.
>
> This is the console output:
>
> [info] Input file: belgium-latest.osm.pbf←[0m
> [info] Profile: profile.lua←[0m
> [info] Threads: 4←[0m
> [info] Using script profile.lua←[0m
> [STXXL-MSG] STXXL v1.4.99 (prerelease/Release) (git
> f7389c79e946430f5e3f7efc15e5
> bcc29183d200) + gnu parallel(__GLIBCXX__)
> [STXXL-MSG] Disk 'd:\temp\stxxl' is allocated, space: 1 MiB, I/O
> implementat
> ion: wincall queue=0 devid=0
> [info] Parsing in progress..←[0m
> [info] input file generated by Osmium (
> http://wiki.openstreetmap.org/wiki/Osmium
> )←[0m
> [info] timestamp: 2015-07-13T21:15:02Z←[0m
> [info] Ignoring turn restrictions←[0m
>
>
> - is there somewhre a log file we can check?
> - does osrm.extract expect all info to be available? I can image that the
> BBox rectangle extract might be missing some nodes or other elements in
> routes/restrictions etc?
> - more generic, what is the information osrm.extract is expecting in an
> osm file?
>
> thanks
>
> Luc
>
>
>
>
>
> ___
> 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] Road speeds and profile restrictions

2015-09-21 Thread Richard Marsden
Thanks, yes that got it working with mapbox::util::get, eg:

double v = mapbox::util::get( (it->second) ).value;

Okay this is for the status which is an integer, so it should be
rounded (and should be either 0 or 207).

dusting off my C++, I've already upgraded my Stroustrup from a
battered 2nd edition to the latest 4th edition. Seems like I need to
catch up on boost, as well :-)

Richard


On Mon, Sep 21, 2015 at 10:14 AM, Richard Marsden  wrote:
> Thanks - yes, I'd found the definition of osrm::json::Object and
> osrm::json::Value, and went through quite a few variations. I'll have
> a look at the boost variant definition.
>
> I didn't know my C++ was so rusty until I tried working with OSRM! I
> used to use it a lot, but it was before boost came along.
>
> richard
>
> On Mon, Sep 21, 2015 at 7:15 AM, Daniel Hofmann  wrote:
>> First of all, don't use C-style casts, a la `(int)myObject;` as this will
>> (in the worst case) degrade to a `reinterpret_cast` and you really don't
>> want this behavior.
>>
>> Now take a look here:
>>>
>>> https://github.com/Project-OSRM/osrm-backend/blob/e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1/include/osrm/json_container.hpp#L84-L87
>>
>> This is the definition of `osrm::json::Object`. Above it you find the
>> definition of `osrm::json::Value`, which is a heterogeneous sum type, making
>> use of the following implementation:
>>> https://github.com/mapbox/variant
>>
>> And here is the basic hello world example for the variant implementation:
>>>
>>> https://github.com/mapbox/variant/blob/bf485dfb59aef26f3ef2183d7c8cad97062b/test/variant_hello_world.cpp
>>
>> Because it mimics Boost.Variant, please have a look at the detailed tutorial
>> here:
>>> http://www.boost.org/doc/libs/1_59_0/doc/html/variant/tutorial.html
>>
>> It shows you among other things how to use the double dispatch visitor
>> pattern for extracting values from a variant.
>>
>> Hope that helps,
>> Daniel
>>
>> On Sun, Sep 20, 2015 at 8:20 PM, Richard Marsden  wrote:
>>>
>>> Steve how did you extract information from the osrm::json::Object
>>> returned object?
>>> I could covert the Object to string, and then parse it with a 3rd
>>> party JSON library, but that seems long-winded.
>>> I've already asked this question on the OSM Q&A site but no anwers yet:
>>>
>>>
>>> https://help.openstreetmap.org/questions/45342/extracting-data-values-from-osrms-osrmjsonobject-using-c
>>>
>>> Text of question:
>>>
>>> I can receive the JSON result successfully and printing it to the
>>> console (as per the online samples), but I am have problems extracting
>>> actual field data. How can I extract individual fields as numbers,
>>> string, etc?
>>>
>>> I've tried various forms of casting, but this is what I have at the
>>> moment (trying to extract the status value):
>>>
>>> const int gr_result_code = routing_machine.RunQuery(route_parameters,
>>> json_result);
>>> std::string sStat("status");
>>> auto it = json_result.values.find(sStat);
>>> osrm::json::Number vv =  (osrm::json::Number) ((*it).second); // doesn't
>>> compile
>>> int v = (int) (vv.value); // probably some dodgy rounding here
>>>
>>> The Number casting is producing compiler errors. I guess I could
>>> convert the object to a string, and then using a third party JSON
>>> parser to extract individual fields, but this seems very wasteful.
>>>
>>>
>>> 
>>> Richard
>>>
>>> On Thu, Sep 17, 2015 at 8:20 PM, Stephen Woodbridge
>>>  wrote:
>>> > Richard,
>>> >
>>> > I have already imbedded OSRM into a C++ application and in fact wrapped
>>> > that
>>> > application into a postgresql database extension. I my case I only need
>>> > data
>>> > for a city but I was making literally billions of calls to osrm.
>>> >
>>> > As Patrick said, OSRM makes random access calls to memory and there are
>>> > a
>>> > lot of variables that come into play like how well the data is clustered
>>> > in
>>> > memory pages, how many page faults you hit, etc. For your specific use
>>> > case
>>> > no one will have a good answer for you and you really need to do some
>>> > performance testing using the product the way you intend it to be used
>>> > and
>>> > see what the performance issues are. Maybe you use case is fine. The
>>> > OSRM
>>> > public service uses lots of memory because it has to support multiple
>>> > random
>>> > requests anywhere in the world and it can not afford to get stuck page
>>> > in
>>> > swap. Using swap and an SSD might be fine in your application, and may
>>> > be it
>>> > won't, but we do not have enough information to consider the problem
>>> > more
>>> > than to give the standard answer - more memory is faster more swapping
>>> > is
>>> > slower.
>>> >
>>> > -Steve
>>> >
>>> >
>>> >
>>> >
>>> > On 9/17/2015 8:45 PM, Richard Marsden wrote:
>>> >>
>>> >> Thanks for the quick reply Patrick.
>>> >>
>>> >>> Presumably I could do the same for world preparation & routing? Have,
>>> >>> perhaps a 100GB+ swap file, ideally on an SSD.
>>> >>
>>> >>
>>

[OSRM-talk] osrm rail extract & lua content

2015-09-21 Thread Luc Van Linden
Hi

We have been trying to test OSRM on the railway lines in Belgium. (on
windows using the windows binary builds)

The full belgian osm file works with the standard profile.lua  (car
profile). We can run extract, prepare and run.

When we try to use a railway profile, osrm.extract stops working.

We have used the following thread without succes:

https://www.mail-archive.com/osrm-talk@openstreetmap.org/msg00320.html

So not clear if we have sufficient things covered in the lua file for the
extract.

tx


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


Re: [OSRM-talk] Road speeds and profile restrictions

2015-09-21 Thread Richard Marsden
Thanks - yes, I'd found the definition of osrm::json::Object and
osrm::json::Value, and went through quite a few variations. I'll have
a look at the boost variant definition.

I didn't know my C++ was so rusty until I tried working with OSRM! I
used to use it a lot, but it was before boost came along.

richard

On Mon, Sep 21, 2015 at 7:15 AM, Daniel Hofmann  wrote:
> First of all, don't use C-style casts, a la `(int)myObject;` as this will
> (in the worst case) degrade to a `reinterpret_cast` and you really don't
> want this behavior.
>
> Now take a look here:
>>
>> https://github.com/Project-OSRM/osrm-backend/blob/e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1/include/osrm/json_container.hpp#L84-L87
>
> This is the definition of `osrm::json::Object`. Above it you find the
> definition of `osrm::json::Value`, which is a heterogeneous sum type, making
> use of the following implementation:
>> https://github.com/mapbox/variant
>
> And here is the basic hello world example for the variant implementation:
>>
>> https://github.com/mapbox/variant/blob/bf485dfb59aef26f3ef2183d7c8cad97062b/test/variant_hello_world.cpp
>
> Because it mimics Boost.Variant, please have a look at the detailed tutorial
> here:
>> http://www.boost.org/doc/libs/1_59_0/doc/html/variant/tutorial.html
>
> It shows you among other things how to use the double dispatch visitor
> pattern for extracting values from a variant.
>
> Hope that helps,
> Daniel
>
> On Sun, Sep 20, 2015 at 8:20 PM, Richard Marsden  wrote:
>>
>> Steve how did you extract information from the osrm::json::Object
>> returned object?
>> I could covert the Object to string, and then parse it with a 3rd
>> party JSON library, but that seems long-winded.
>> I've already asked this question on the OSM Q&A site but no anwers yet:
>>
>>
>> https://help.openstreetmap.org/questions/45342/extracting-data-values-from-osrms-osrmjsonobject-using-c
>>
>> Text of question:
>>
>> I can receive the JSON result successfully and printing it to the
>> console (as per the online samples), but I am have problems extracting
>> actual field data. How can I extract individual fields as numbers,
>> string, etc?
>>
>> I've tried various forms of casting, but this is what I have at the
>> moment (trying to extract the status value):
>>
>> const int gr_result_code = routing_machine.RunQuery(route_parameters,
>> json_result);
>> std::string sStat("status");
>> auto it = json_result.values.find(sStat);
>> osrm::json::Number vv =  (osrm::json::Number) ((*it).second); // doesn't
>> compile
>> int v = (int) (vv.value); // probably some dodgy rounding here
>>
>> The Number casting is producing compiler errors. I guess I could
>> convert the object to a string, and then using a third party JSON
>> parser to extract individual fields, but this seems very wasteful.
>>
>>
>> 
>> Richard
>>
>> On Thu, Sep 17, 2015 at 8:20 PM, Stephen Woodbridge
>>  wrote:
>> > Richard,
>> >
>> > I have already imbedded OSRM into a C++ application and in fact wrapped
>> > that
>> > application into a postgresql database extension. I my case I only need
>> > data
>> > for a city but I was making literally billions of calls to osrm.
>> >
>> > As Patrick said, OSRM makes random access calls to memory and there are
>> > a
>> > lot of variables that come into play like how well the data is clustered
>> > in
>> > memory pages, how many page faults you hit, etc. For your specific use
>> > case
>> > no one will have a good answer for you and you really need to do some
>> > performance testing using the product the way you intend it to be used
>> > and
>> > see what the performance issues are. Maybe you use case is fine. The
>> > OSRM
>> > public service uses lots of memory because it has to support multiple
>> > random
>> > requests anywhere in the world and it can not afford to get stuck page
>> > in
>> > swap. Using swap and an SSD might be fine in your application, and may
>> > be it
>> > won't, but we do not have enough information to consider the problem
>> > more
>> > than to give the standard answer - more memory is faster more swapping
>> > is
>> > slower.
>> >
>> > -Steve
>> >
>> >
>> >
>> >
>> > On 9/17/2015 8:45 PM, Richard Marsden wrote:
>> >>
>> >> Thanks for the quick reply Patrick.
>> >>
>> >>> Presumably I could do the same for world preparation & routing? Have,
>> >>> perhaps a 100GB+ swap file, ideally on an SSD.
>> >>
>> >>
>> >>> This will fall apart when you have some actual load pressure on the
>> >>> system. We need random access to memory, which will create a lot of
>> >>> page faults (== slow). Even an SSD is not even close to memory speed.
>> >>
>> >>
>> >>> You have two options:
>> >>> split the datasets
>> >>> get a bigger server
>> >>
>> >>
>> >>
>> >> I would imagine that is the case for the standard http server. I was
>> >> thinking of using it as a linked library from a C++ program. Splitting
>> >> the datasets by continent is a possibility though.
>> >>
>> >> (writing a C# interface wa

[OSRM-talk] osrm extract on a osm file created using a using BBox query

2015-09-21 Thread Luc Van Linden
Hi

We are currently testing the usage of OSRM (on windows using the published
binaries) and the way the profile.lua file needs to be configured to
minimise the resulting graph.

We would like to understand which part of the lua file will actually
"decide" if a specific element/tag/way is included in the graph.

We have tested with afull belgian coverage. The standard profile.lua file
works for extract/prepare and run.

However when we use a small but substantial relevant subset of Belgium,
using a BBOX, osrm_extract fails. A windows messagebox pops up, just a
message saying the program osrm.extract has stopped working.

This is the console output:

[info] Input file: belgium-latest.osm.pbf←[0m
[info] Profile: profile.lua←[0m
[info] Threads: 4←[0m
[info] Using script profile.lua←[0m
[STXXL-MSG] STXXL v1.4.99 (prerelease/Release) (git
f7389c79e946430f5e3f7efc15e5
bcc29183d200) + gnu parallel(__GLIBCXX__)
[STXXL-MSG] Disk 'd:\temp\stxxl' is allocated, space: 1 MiB, I/O
implementat
ion: wincall queue=0 devid=0
[info] Parsing in progress..←[0m
[info] input file generated by Osmium (
http://wiki.openstreetmap.org/wiki/Osmium
)←[0m
[info] timestamp: 2015-07-13T21:15:02Z←[0m
[info] Ignoring turn restrictions←[0m


- is there somewhre a log file we can check?
- does osrm.extract expect all info to be available? I can image that the
BBox rectangle extract might be missing some nodes or other elements in
routes/restrictions etc?
- more generic, what is the information osrm.extract is expecting in an osm
file?

thanks

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


Re: [OSRM-talk] Information on age/timestamp of data currently used in map.project-osrm.org/?

2015-09-21 Thread Daniel Hofmann
The project-osrm.org demo router currently runs on stale data --- this is a
known issue and we're working on fixing it asap.

On Mon, Sep 21, 2015 at 1:25 PM, Rudolf Mayer 
wrote:

> Hi!
>
> I was wondering if there is a way to obtain information on the age or
> timestamp of the data that is currently used to compute routes in the
> backend? In the bottom-right there is an option to show the GUI version,
> but for "data" it displays me "N/A".
>
> I have a route where a new piece of road was marked finished around 7 days
> ago, but OSRM still doesn't know about it.
>
> Thanks,
> Rudolf
>
> ___
> 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] Road speeds and profile restrictions

2015-09-21 Thread Daniel Hofmann
First of all, don't use C-style casts, a la `(int)myObject;` as this will
(in the worst case) degrade to a `reinterpret_cast` and you really don't
want this behavior.

Now take a look here:
>
https://github.com/Project-OSRM/osrm-backend/blob/e1ac1c4fdc062a0e5c017d268d0a7fcb25bbbab1/include/osrm/json_container.hpp#L84-L87

This is the definition of `osrm::json::Object`. Above it you find the
definition of `osrm::json::Value`, which is a heterogeneous sum type,
making use of the following implementation:
> https://github.com/mapbox/variant

And here is the basic hello world example for the variant implementation:
>
https://github.com/mapbox/variant/blob/bf485dfb59aef26f3ef2183d7c8cad97062b/test/variant_hello_world.cpp

Because it mimics Boost.Variant, please have a look at the detailed
tutorial here:
> http://www.boost.org/doc/libs/1_59_0/doc/html/variant/tutorial.html

It shows you among other things how to use the double dispatch visitor
pattern for extracting values from a variant.

Hope that helps,
Daniel

On Sun, Sep 20, 2015 at 8:20 PM, Richard Marsden  wrote:

> Steve how did you extract information from the osrm::json::Object
> returned object?
> I could covert the Object to string, and then parse it with a 3rd
> party JSON library, but that seems long-winded.
> I've already asked this question on the OSM Q&A site but no anwers yet:
>
>
> https://help.openstreetmap.org/questions/45342/extracting-data-values-from-osrms-osrmjsonobject-using-c
>
> Text of question:
>
> I can receive the JSON result successfully and printing it to the
> console (as per the online samples), but I am have problems extracting
> actual field data. How can I extract individual fields as numbers,
> string, etc?
>
> I've tried various forms of casting, but this is what I have at the
> moment (trying to extract the status value):
>
> const int gr_result_code = routing_machine.RunQuery(route_parameters,
> json_result);
> std::string sStat("status");
> auto it = json_result.values.find(sStat);
> osrm::json::Number vv =  (osrm::json::Number) ((*it).second); // doesn't
> compile
> int v = (int) (vv.value); // probably some dodgy rounding here
>
> The Number casting is producing compiler errors. I guess I could
> convert the object to a string, and then using a third party JSON
> parser to extract individual fields, but this seems very wasteful.
>
>
> 
> Richard
>
> On Thu, Sep 17, 2015 at 8:20 PM, Stephen Woodbridge
>  wrote:
> > Richard,
> >
> > I have already imbedded OSRM into a C++ application and in fact wrapped
> that
> > application into a postgresql database extension. I my case I only need
> data
> > for a city but I was making literally billions of calls to osrm.
> >
> > As Patrick said, OSRM makes random access calls to memory and there are a
> > lot of variables that come into play like how well the data is clustered
> in
> > memory pages, how many page faults you hit, etc. For your specific use
> case
> > no one will have a good answer for you and you really need to do some
> > performance testing using the product the way you intend it to be used
> and
> > see what the performance issues are. Maybe you use case is fine. The OSRM
> > public service uses lots of memory because it has to support multiple
> random
> > requests anywhere in the world and it can not afford to get stuck page in
> > swap. Using swap and an SSD might be fine in your application, and may
> be it
> > won't, but we do not have enough information to consider the problem more
> > than to give the standard answer - more memory is faster more swapping is
> > slower.
> >
> > -Steve
> >
> >
> >
> >
> > On 9/17/2015 8:45 PM, Richard Marsden wrote:
> >>
> >> Thanks for the quick reply Patrick.
> >>
> >>> Presumably I could do the same for world preparation & routing? Have,
> >>> perhaps a 100GB+ swap file, ideally on an SSD.
> >>
> >>
> >>> This will fall apart when you have some actual load pressure on the
> >>> system. We need random access to memory, which will create a lot of
> >>> page faults (== slow). Even an SSD is not even close to memory speed.
> >>
> >>
> >>> You have two options:
> >>> split the datasets
> >>> get a bigger server
> >>
> >>
> >>
> >> I would imagine that is the case for the standard http server. I was
> >> thinking of using it as a linked library from a C++ program. Splitting
> >> the datasets by continent is a possibility though.
> >>
> >> (writing a C# interface was another thought, but that would be a
> >> different use case and definitely with smaller datasets)
> >>
> >> Cheers,
> >>
> >> Richard
> >>
> >>
> >>
> >>
> >> On Thu, Sep 17, 2015 at 4:37 PM, Patrick Niklaus
> >>  wrote:
> >>>
> >>> W.r.t. the pre-preprocessing you are correct.
> >>>
>  What is that extra power used for?
> >>>
> >>>
> >>> Including all sorts of external data sources. Also the logic in the
> >>> lua profiles is not just replaceable by simple key-value pairs, OSM
> >>> requires you to handle a lot of special cases.
> >>>

[OSRM-talk] Information on age/timestamp of data currently used in map.project-osrm.org/?

2015-09-21 Thread Rudolf Mayer

Hi!

I was wondering if there is a way to obtain information on the age or 
timestamp of the data that is currently used to compute routes in the 
backend? In the bottom-right there is an option to show the GUI version, 
but for "data" it displays me "N/A".


I have a route where a new piece of road was marked finished around 7 
days ago, but OSRM still doesn't know about it.


Thanks,
Rudolf

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