Hi, I've downloaded my regional map from http://download.geofabrik.de/ and now I only want to calculate distance between two point (coordinates) using C# I've read about BruTile and OSM, but I've no found any piece of code which implements my needs. Map Rendering is not necessary for me, duration either. I mean, input: two coordinates, output: XX KM. That's all. Could anybody please help me? Thanks in advance.
showing 5 of 6
show 1 more comments
|
I was able to get a result in meters from the code below... however, it took 3.5 minutes to calculate the distance between two points that are 12357 meters apart. I used the osm.pbf for Oklahoma that is 116mb. Install VS 2012, Install NuGet Extension, Install OSMSharp via NuGet. Start a new windows app for C#:
answered 20 Apr '16, 19:22 kttii |
Did you already read the routing wiki page? It even mentions some tools for C#, for example OsmSharp. answered 29 Jun '15, 10:14 scai ♦ Hi, Now, i am testing https://github.com/OsmSharp/OsmSharp/wiki/A-getting-started-example but, because my map size is about 500MB it fails (memory exception). I am also trying "https://github.com/OsmSharp/OsmSharpDataProcessor/wiki" but I can't do anything with it...
(29 Jun '15, 11:02)
doShare
|
Hi again,
I've found a solution consisting in import map to mySQL:
I also have installed: MySQL and PERL
The instructions are not clear for me...I dont know how to, import my .osm/.osm.bz2 maps into MySQL and, moreover, how to test distances/routes between two coordinates...
I have installed all the packages into Perl Package Manager, but i am not sure that my installation was fine.
Thanks in advance
That's a completely different question. And why would you want to use MySQL instead of PostgreSQL? There are dozens of instructions for how to import OSM data into a PostgreSQL database. Don't choose a different database unless you have very good reasons for this decision.
Thanks,
Maybe the question sounds different, but my goal is the same: Obtain real distance (route) between two points offline using OSM. Firstly, I've tried with .NET c# but, because the map size (arround 400MB) the solution doesnt work. So, I am trying to obtain results migrating the map into DataBase. I've tried with mySQL because my .NET application runs over MySQL but, if PostgreSQL is easier, I will look for information / how to. Any suggestion?
Thanks in advance
If OsmSharp can't handle large maps then you could think about installing a separate routing service, such as GraphHopper or OSRM.
I thought it was Postgis which is Postgres + a GIS extension. The latter provides functionality to work with point, lines and areas.
Thanks for your help. I've implemented my .NET Solution with GraphHopper. Now, I'm looking for an option to avoid running Terminal Cygwin64 permanently (It starts a local map website)