itinero / routing

The routing core of itinero.
Apache License 2.0
221 stars 69 forks source link

routerDb.LoadOsmData problem #207

Closed taskhiri closed 6 years ago

taskhiri commented 6 years ago

hi , i am use this code :

using Itinero; using Itinero.Elevation; using Itinero.IO.Osm; using Itinero.LocalGeo; using Itinero.LocalGeo.Elevation; using Itinero.Osm.Vehicles; using SRTM; using System; using System.IO;

public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) {

     var routerDb = new RouterDb();
    using (var stream = new FileInfo(@"/testItinero/luxembourg-latest.osm.pbf").OpenRead())
    {
        routerDb.LoadOsmData(stream, Vehicle.Car);
    }
    var router = new Router(routerDb);

    // calculate a route.
    var route = router.Calculate(Vehicle.Car.Fastest(), new Coordinate(49.75635954613685f, 6.095362901687622f),
            new Coordinate(49.75263039062888f, 6.098860502243042f));

    var geoJson = route.ToGeoJson();

}

BUT i see this when run :

Method not found: 'Boolean Itinero.Attributes.IAttributeCollection.TryGetValue(System.String, System.String ByRef)'.

Line 27: routerDb.LoadOsmData(stream, Vehicle.Car);

why ?

thanks if you can help us .

xivk commented 6 years ago

This looks like an issue with Reminiscense, make sure the package is up to date. Perhaps there is an issue with the nugets. What version of Itinero did you install?

taskhiri commented 6 years ago

1.3.2

xivk commented 6 years ago

You can't use SRTM with the latest stable, this is available only in the prereleases.

(I know, we need a new stable release, working in it.)

taskhiri commented 6 years ago

SRTM deleted by me but error not correct...

taskhiri commented 6 years ago

and i delete all packages and reinstall this packages again :

Itinero NuGet Itinero.Geo NuGet Itinero.IO.Osm NuGet Itinero.IO.Shape NuGet

as this page : http://docs.itinero.tech/docs/itinero/index.html

xivk commented 6 years ago

For the piece of code above, try just installing Itinero.IO.Osm

taskhiri commented 6 years ago

:(

xivk commented 6 years ago

Start over in a console project and follow the example exactly and install this package:

https://www.nuget.org/packages/Itinero.IO.Osm/1.4.0-pre63

Or start from this example project:

https://github.com/itinero/routing/blob/develop/samples/Sample.Basic/Program.cs

taskhiri commented 6 years ago

i do this now i see this error :

Method not found: 'System.Nullable`1 OsmSharp.Node.get_Latitude()'.

xivk commented 6 years ago

Make sure OsmSharp is up to date... are you using nuget to install this? Because this should all be installed automatically these dependencies.

taskhiri commented 6 years ago

i'm using OSMSHARP 6.0.1

xivk commented 6 years ago

Then I don't know what's going on. I will keep this issue on an try with an empty project myself to see if everything still works as it should in a few days.

Itinero 1.4.0 works with OsmSharp 6 and Itinero 1.3.2 with OsmSharp 5 so one of them is out of sync, install Itinero.IO.Osm 1.4.0-pre63 then you should be fine with OsmSharp 6 and you shouldn't get the message above.

xivk commented 6 years ago

Closing, this, feel free to reopen if you have more questions.