{"id":2516,"date":"2021-08-11T15:36:59","date_gmt":"2021-08-11T14:36:59","guid":{"rendered":"https:\/\/www.jurecuhalev.com\/blog\/?p=2516"},"modified":"2021-08-11T15:48:50","modified_gmt":"2021-08-11T14:48:50","slug":"optimal-route-finding","status":"publish","type":"post","link":"https:\/\/www.jurecuhalev.com\/blog\/optimal-route-finding\/","title":{"rendered":"Finding optimal route between different points on a map"},"content":{"rendered":"\n<p>This is a detailed process description how you can build your own optimal route between different points on a map. It&#8217;s a description of how to route <a href=\"https:\/\/www.jurecuhalev.com\/blog\/2021\/08\/11\/ljubljana-space-invaders-map-route\/\" data-type=\"post\" data-id=\"2525\">Ljubljana&#8217;s Space Invaders<\/a> but it&#8217;s useful for all sorts of routing problems.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Clean your data<\/h2>\n\n\n\n<p>I got locations in a Word files that used a number of different ways to describe each point:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"553\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word-1024x553.png\" alt=\"\" class=\"wp-image-2517\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word-1024x553.png 1024w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word-550x297.png 550w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word-768x415.png 768w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word-1536x830.png 1536w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/word.png 1584w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Computers don&#8217;t like this format<\/figcaption><\/figure>\n\n\n\n<p>So now we need to normalise the data and make sure that it&#8217;s computer readable. I&#8217;ve opted to manually go through all the links and build a <a href=\"https:\/\/docs.google.com\/spreadsheets\/d\/1KZUdqBrcIdTSwbBYW_ZOJlwzeTvAzKYTy-Gg0S_z_Rc\/edit?usp=sharing\">Google Sheets table<\/a>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"351\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/sheets-1-1024x351.png\" alt=\"\" class=\"wp-image-2519\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/sheets-1-1024x351.png 1024w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/sheets-1-550x188.png 550w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/sheets-1-768x263.png 768w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/sheets-1.png 1183w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Computers are happier with uniform tabular data<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Route the data<\/h2>\n\n\n\n<p>There&#8217;s not a lot of cheap affordable options online. There are developer interfaces but it seemed like too much work for a one-time thing. I ended up using <a href=\"https:\/\/www.routexl.com\/\">RouteXL<\/a> to calculate optimal route. It costs 5 EUR\/day to input more than 20 addresses. So I paid that and pasted all 30 coordinates.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1020\" height=\"784\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/routexl.png\" alt=\"\" class=\"wp-image-2521\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/routexl.png 1020w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/routexl-550x423.png 550w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/routexl-768x590.png 768w\" sizes=\"auto, (max-width: 1020px) 100vw, 1020px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Think about the data<\/h2>\n\n\n\n<p>Once you have a route you can then start thinking if it makes sense and if you need to put some more restrictions in the system. In my case there are far away points that would make more sense to be handled separately.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"961\" src=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/full_map-1024x961.png\" alt=\"\" class=\"wp-image-2522\" srcset=\"https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/full_map-1024x961.png 1024w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/full_map-550x516.png 550w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/full_map-768x721.png 768w, https:\/\/www.jurecuhalev.com\/blog\/wp-content\/uploads\/2021\/08\/full_map.png 1124w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Final result<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">What I learned<\/h2>\n\n\n\n<p>It&#8217;s worth finding a small website that does that one thing well. I looked at Google Maps API&#8217;s and it would taken me so much longer than just paypaling a few euros.<\/p>\n\n\n\n<p>Cleaning the data is always the most time consuming part.<\/p>\n\n\n\n<p>It&#8217;s getting easier to do these kind of small single evening projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a detailed process description how you can build your own optimal route between different points on a map. It&#8217;s a description of how to route Ljubljana&#8217;s Space Invaders but it&#8217;s useful for all sorts of routing problems. Step 1: Clean your data I got locations in a Word files that used a number [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16],"tags":[],"class_list":["post-2516","post","type-post","status-publish","format-standard","hentry","category-ideas"],"acf":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2516","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/comments?post=2516"}],"version-history":[{"count":4,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2516\/revisions"}],"predecessor-version":[{"id":2529,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/posts\/2516\/revisions\/2529"}],"wp:attachment":[{"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/media?parent=2516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/categories?post=2516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jurecuhalev.com\/blog\/wp-json\/wp\/v2\/tags?post=2516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}