[DOCKER] I tried running the route search engine (OSRM) easily with a container

background

Once again, I found it very useful to use Docker (container), so I decided to organize the case as a memorandum.

What did you want to do in the first place

I wanted to easily use ** OSRM (Open Source Routing Machine) **, a route search engine that uses ** OpenStreetMap (OSM) **, but it seems that it is troublesome to build the environment, so I can not do anything. I was investigating.

What, the already built environment was provided as a Docker image

In Project-OSRM / osrm-backend, there was the following description.

The easiest and quickest way to setup your own routing engine is to use Docker images we provide.

Moreover, just by executing the following command, the container image is acquired (downloaded) from dockerhub, and a container (as a route search engine) is created and started from that image.

docker run -t -i -p 5000:5000 -v "${PWD}:/data" osrm/osrm-backend osrm-routed --algorithm mld /data/kanto-latest.osrm &

In this example, ** osrm / osrm-backend ** is the container image and ** osrm-routed ** is the command to run inside the container.

However, the following work is required in advance for this execution. Among them, the following formatting and optimization processing is executed by starting a new container from osrm / osrm-backend (starting the command for that processing as a container).

--Download the map (OSM) used by OSRM --Formatted for use with OSRM --Optimization of speed for walking, cars, bicycles, etc. --Other

Originally, it is said that processing other than ** 2. 6. 7. is required ** by the following procedure, so you can see that you can try it faster and more reliably by using Docker.

  1. Update and security
  2. ** Download Map Export **
  3. Dependency installation
  4. Compile OSRM
  5. STXXL configuration
  6. ** Map extraction **
  7. ** Calculation of travel time **
  8. Running and testing web services
  9. Nginx setup
  10. Supervisor installation and configuration

So, I was able to reconfirm that it is very easy to build an execution environment by using a container image.

For reference, I executed the following command on the route search engine launched above to get the route information (JSON format).

In this example, in order to get the walking route from Kita-Kamakura to the Great Buddha of Kamakura, each location information is thrown to the search engine as a parameter.

curl --noproxy 127.0.0.1 'http://127.0.0.1:5000/route/v1/walking/139.545056,35.337103;139.535689,35.316696?alternatives=3&geometries=geojson' | jq 'def hexdec(i): "0123456789abcdef"[i:i+1]; {"type": "FeatureCollection", "features": [[.routes[].geometry] | [., keys] | transpose[] | {"geometry": .[0], "type": "Feature", "properties": {"stroke-width": 2, "stroke": ("#" + hexdec(15-.[1]*2) + hexdec(.[1]*2) + hexdec(.[1]*2))}}]}' > routes_kamakura.json

Then, when the acquired Json format file is loaded on ** geojson.io **, there are multiple walking courses from Kita-Kamakura to the Great Buddha of Kamakura as shown below. I got the route. (This is a separate article that I would like to organize)

kamakura.PNG

Recommended Posts

I tried running the route search engine (OSRM) easily with a container
I tried running Ansible on a Docker container
I tried running a Docker container on AWS IoT Greengrass 2.0
I tried running a letter of credit transaction application with Corda 1
I tried deploying a Docker container on Lambda with Serverless Framework
I tried playing with BottomNavigationView a little ①
Run a DMN with the Camunda DMN Engine
I tried running the Angular sample in Auth0 Quick Start with Docker
[API] I tried using the zip code search API
I tried to break a block with java (1)
I tried running Java on a Mac terminal
I tried to decorate the simple calendar a little
[Rails] I tried playing with the comment send button
I tried OCR processing a PDF file with Java
I tried to create a java8 development environment with Chocolatey
I tried using the GitHub repository as a library server
I tried to modernize a Java EE application with OpenShift.
I tried to increase the processing speed with spiritual engineering
[Rails] I tried to create a mini app with FullCalendar
I tried JAX-RS and made a note of the procedure
[Docker] Delete only the volume associated with a specific container
I tried running WordPress with docker preview on M1 Mac.
I tried to create a padrino development environment with Docker
I tried OCR processing a PDF file with Java part2
I tried using the CameraX library with Android Java Fragment
I tried upgrading from CentOS 6.5 to CentOS 7 with the upgrade tool
I tried to express the result of before and after of Date class with a number line
I tried to take a look at the flow of Android development environment construction with Android Studio
I tried DI with Ruby
I tried the Docker tutorial!
I tried the VueJS tutorial!
I tried the FizzBuzz problem
I tried UPSERT with PostgreSQL.
I tried BIND with Docker
I tried printing a form with Spring MVC and JasperReports 1/3 (JasperReports settings)
I tried to solve the problem of "multi-stage selection" with Ruby
I tried printing a form with Spring MVC and JasperReports 3/3 (Spring MVC control)
I tried to illuminate the Christmas tree in a life game
I made a Ruby container image and moved the Lambda function
I tried to build the environment of PlantUML Server with Docker
I tried to implement the image preview function with Rails / jQuery
I tried using the cache function of Application Container Cloud Service
I got a warning message with the rails _6.0.3_ new hello_myapp command
I made a simple search form with Spring Boot + GitHub Search API.
I took a look at the resources of Azure Container Instance
I tried to check the operation of gRPC server with grpcurl
[Java] I tried to make a maze by the digging method ♪
I tried to make a group function (bulletin board) with Rails