I am planning to do a PhD in supply chain optimization. I want to solve a warehouse localization problem. I have 120 long, alt addresses in West Europe. I need to calculate distances when using a clustering algorithm, then use a grid to locate the best option for the warehouse. For this purpose I will need to calculate the distances approximately 120 thousand times. I think opensteetmap is the best option for this problem.

  1. Can anybody provide some information from what to start? For now I have an algorithm made with Wolfram Mathematica, However I didn’t find any openstreetmap scripts that would work with this software.

  2. Is there any finished application that I could use and communicate with it easily? E.g. googlemap api works, however it has a 2500 day limit and extra calculations would cost a lot.

  3. Is it possible to use simply a web link, that wouldn’t have any limitations? Maybe someone could provide it and for a few days turn off the limits for my IP address?

  4. If no, how should I use openstreetmap to solve this problem? Do I need to download the osm planet file and write the code to return the distance between A and B, or is there any completed solutions? I would need to remake the algorithm with another programming language in this case.

I would be really grateful for any advice or help,

thank you in advanced

asked 28 Nov '15, 18:08

ValentasG's gravatar image

ValentasG
11223
accept rate: 0%


There might be web routing algorithms that aren't protectd well enough to kick you out when you make 120k requests but you really shouldn't. It is much better - and it is the beauty of OSM that this is possible - to download the data and run your own routing software on it. There's Europe-only data extracts e.g. at download.geofabrik.de, and you can easily feed them into OSRM or Graphhopper - both free and open source routing engines that work with OSM data out of the box. Both have a HTTP API that you could use locally, but OSRM is in C++ with NodeJS bindings and Graphhopper is in Java, so it would probably be possible to integrate them into your application in a more direct fashion.

permanent link

answered 28 Nov '15, 20:59

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
69.4k806291086
accept rate: 24%

Thank you Frederik for your replay.

When I used googlemaps API, I simply provided the long and alt coordinates and the API returned the distance. As I understand I can do the same thing by hosting a local map API on my own computer? Or I will need to rewrite my algorithm with C++ or Java?

I have checked graphhopper and it should be just the thing that I need, however as I understood I have still a query limit? "To increase your query limits for production you pay online within a few minutes via credit card or debit advice." As a free user I have the same amount as with googlemap api "500 per day". Or if I use a local computer the limits won't concern me?

I am downloading europe-latest.osm.pbf file, so thank you again for the tips :)

(28 Nov '15, 21:35) ValentasG
1

The limit doesn't apply for a local installation, of course.

(29 Nov '15, 09:06) scai ♦

I think there's one basic Graphhopper package and one API package, and if you install the API then you can access your own local Graphhopper through a web API just like you did with Google. And no, there won't be limits other than how fast your hardware can go ;)

(29 Nov '15, 14:55) Frederik Ramm ♦

I'm assuming by distance, you're talking about road length distance or travel time. If you're after direct line distance, this can easily be calculated by simple math from the latitude and longitude.

OSRM offers a table query which would probably reduce the number of calls you need to make. Their usage policy seems to allow you to do this with the publicly available server, but if you wanted to run your own server you could do it and you'd only need to load data for the part of Western Europe you need.

permanent link

answered 30 Nov '15, 17:44

pnorman's gravatar image

pnorman
2.3k52140
accept rate: 19%

Yes I am talking about the distance and travel time between. I am using now a simply, math formula, however for a correct optimization algorithm I need real distances between points. I understand that I need to do offline routing, because I will need to make requests about 120 thousand times. Otherwise, my IP should get blocked.

I have finished a algorithm with Wolfram Mathematica, I am working with googlemaps API distdata = Import["http://maps.googleapis.com/maps/api/directions/json?origin=" <> from <> "&destination=" <> to <> "&region=es&sensor=false", {"HTML", "Source"}]; roadDistance = StringSplit[StringSplit[distdata, ":"][[13]],","][[1]] travelTime = StringSplit[StringSplit[distdata, ":"][[16]], ","][[1]]"

I would like similarly to googlemaps API provide longitude altitude coordinates for point A and B and receive back the distance and travel time for car/truck type vehicle. I have a recommendation to use GraphHopper with Java script. Launching a server would be difficult in this case. It is not necessary to rewrite my algorithm with Java script? Communication between Wolfram Mathematica and OSM should be possible? But how should I do it?

(30 Nov '15, 19:18) ValentasG
1

Please note that there is no free solution based on OSM that allows you to make that many requests. It costs money to run a server with the whole planet dump and to provide bandwidth for so many requests. I think you either have to run your local server (and thus pay the cost) or pay for a geocoding solution.

See Frederiks comment on https://help.openstreetmap.org/questions/46914/nominatim-alternative which states the same

(01 Dec '15, 06:09) escada
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×13
×5
×2
×2

question asked: 28 Nov '15, 18:08

question was seen: 2,779 times

last updated: 01 Dec '15, 06:09

powered by OSQA