itinero / routing-api

An API based on Itinero.
MIT License
13 stars 16 forks source link

Error on provided example #14

Open joined opened 6 years ago

joined commented 6 years ago

Ubuntu 17.10, using the example provided in the docs:

$ http -p Hhb GET http://localhost:5000/belgium/routing\?profile\=car\&loc\=51.055207,3.722992\&loc\=50.906497,4.194031 Accept=application/json

GET /belgium/routing?profile=car&loc=51.055207,3.722992&loc=50.906497,4.194031 HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 30
Content-Type: application/json
Host: localhost:5000
User-Agent: HTTPie/0.9.9

HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8
Date: Fri, 23 Feb 2018 14:29:27 GMT
Link: </routing.xml>; rel="alternate"; type="application/xml"
Server: Kestrel
Transfer-Encoding: chunked
Vary: Accept

{
    "details": "<pre>Nancy.RequestExecutionException: Oh noes! ---&lt; System.NullReferenceException: Object reference not set to an instance of an object.
    at Itinero.Result`1.get_Value()
    at Itinero.API.Instances.Instance.Calculate(String profileName, Coordinate[] coordinates) in /[...]/routing-api/src/Itinero.API/Instances/Instance.cs:line 132
    at Itinero.API.Modules.RoutingModule.DoRouting(Object _) in /[...]/routing-api/src/Itinero.API/Modules/RoutingModule.cs:line 91
    at Itinero.API.Modules.RoutingModule.&gt;.ctor&lt;b__0_0(Object _) in /[...]/routing-api/src/Itinero.API/Modules/RoutingModule.cs:line 38
    at Nancy.NancyModule.&gt;&lt;c__DisplayClass14_0`1.&gt;Get&lt;b__0(Object args)
    at Nancy.NancyModule.&gt;&lt;c__DisplayClass16_0`1.&gt;Get&lt;b__0(Object args, CancellationToken ct)
    at Nancy.Routing.Route`1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)
    at Nancy.Routing.DefaultRouteInvoker.&gt;Invoke&lt;d__2.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Nancy.Routing.DefaultRequestDispatcher.&gt;Dispatch&lt;d__5.MoveNext()\n--- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Nancy.NancyEngine.&gt;InvokeRequestLifeCycle&lt;d__22.MoveNext()
    --- End of inner exception stack trace ---
    at Nancy.NancyEngine.InvokeOnErrorHook(NancyContext context, ErrorPipeline pipeline, Exception ex)</pre>",
    "message": "Something went horribly, horribly wrong while servicing your request.",
    "statusCode": 500
}

The routerdb seems correctly loaded:

$ ./run.sh
Microsoft (R) Build Engine version 15.5.180.51428 for .NET Core                                
Copyright (C) Microsoft Corporation. All rights reserved.                                      

  Restore completed in 18.48 ms for /[...]/routing-api/src/Itinero.API/Itinero.API.csproj.                                                            
  Itinero.API -> /[...]/routing-api/src/Itinero.API/bin/Debug/netcoreapp2.0/Itinero.API.dll                                                           

Build succeeded.                               
    0 Warning(s)                               
    0 Error(s)                                 

Time Elapsed 00:00:02.39                       
Using launch settings from /[...]/routing-api/src/Itinero.API/Properties/launchSettings.json...                                                       [Bootstrapper] information - Loading all routerdb's from path: /[...]/routing-api/src/Itinero.API/data                                                [Bootstrapper] information - Loading instance belgium from: /[...]/routing-api/src/Itinero.API/data/belgium.a.routerdb                                [Bootstrapper] information - Loading instance netherlands from: /[...]/routing-api/src/Itinero.API/data/netherlands.c.cf.routerdb                     Hosting environment: Development               
Content root path: /[...]/routing-api/src/Itinero.API 
Now listening on: http://localhost:5000        
Application started. Press Ctrl+C to shut down.                                                
[Bootstrapper] information - Loaded instance belgium from: /[...]/routing-api/src/Itinero.API/data/belgium.a.routerdb                                 
[Bootstrapper] information - Loaded instance netherlands from: /[...]/routing-api/src/Itinero.API/data/netherlands.c.cf.routerdb                      
[RouterBaseExtensions] information - Profile(s) car not cached, building cache.                
[RouterBaseExtensions] information - Profile(s) car not cached, building cache. 

Any ideas?

grsb007 commented 5 years ago

I am also getting same error, can you please help me on this

aanddre commented 5 years ago

Any updates for this issue?

elecay commented 4 years ago

To fix this issue I have done two things:

  1. Update core libraries (see my PR: https://github.com/itinero/routing-api/pull/19)
  2. Create a new RouterDb using Itinero's IDP tool: https://github.com/itinero/idp

For this last step, download the last stable build (look at the bottom here: http://files.itinero.tech/builds/idp/prereleases/)

Then, just follow the tutorial steps.

Example

To create a new RouteDb for Catalunya (Spain), download the OSM file from OpenStreetMap (https://download.openstreetmap.fr/extracts) database: https://download.openstreetmap.fr/extracts/europe/spain/catalunya-latest.osm.pbf

Then:

> ./idp --read-pbf catalunya-latest.osm.pbf --pr --create-routerdb vehicles=car --contract car --elevation --write-routerdb catalunya.routerdb

(Note: If you're using Linux, like me, make sure to change idp for IDP; note the uppercase. Also, make sure to make that file executable: chmod +x IDP)

Now, move catalunya.routerdb to the folder you have defined as routingfilepath in routing-api/src/Itinero.API/appsettings.json

Then: > ./run.sh