7 ms·
How to make fancy road trip maps with R and OpenStreetMap
- tony-allan 3y agoCool! Curious — has anyone done something similar in Python?
- poobear22 3y agoThank you! Love R.
- antisthenes 3y agoA little underwhelming for so much work, but I guess if you already have R installed, then it's just plug and play. Thanks for sharing.
- deleted 3y ago[deleted]
- Helmut10001 3y agoWhy is there such a movement for making maps with R? The python ecosystem has more and better packages for making maps already. Notwithstanding that there are indeed some nice results, this new R toolchain movement towards maps feels like a waste of open source energy to me.
- jackdaniel 3y agoCan we, I don't know, let people enjoy programming languages they like without calling it a waste?
- minimaxir 3y agoAs someone proficient with R and Python, anything data viz-wise is substantially easier to do in R/ggplot2, particularly something complicated like this post. Most of the R packages in this post aren't that new either.
- pjacotg 3y agoI agree with that. I've been programming on and off in Python since 2008 and really like the language. I started using R just over a year ago after joining a new team. It took a while to adjust but I've gotten to prefer it for exploratory data analysis and data viz.
- jarenmf 3y agoMy same experience, I have built fairly big projects with Python and I like it for general tasks but whenever I have something data analytics/visualization related I find myself reaching for R. There is so much functionality built into the language that just makes me so efficient.
- dacryn 3y agosame here, I love me some ggplot. Python for everything, but if I need to make something nice to look at, R makes my life so much easier, and the final touch in Affinity Designer/Photo. In jupyter it's trivial to mix and match python and R anyway, all the wrangling in python and once it's clean, just basic tidyverse in R
- a_bonobo 3y agoI feel like the R ecosystem was there first; but perhaps two completely separate groups of people. Ecologists, researchers working with geological or geospatial data use R and have been using R for a long, long time. The 'old 'standard library 'maps' is decades old by now, with maps v3 now being 8 years old. maps v2 goes back to 2003, about the time of Python 2.3? I can't even find the sources of maps v1. https://cran.r-project.org/src/contrib/Archive/maps/ https://cran.r-project.org/src/contrib/Archive/maps/ I believe that maps v1 was for R's predecessor, S, so from the late 90s, about the time Python 1.5 came out. Was anybody even using Python then? OP's post uses the slightly fancier tidyverse-versions of these decades-old libraries. I think it's safe to say that map-making libraries are older in R than in Python.
- ezconnect 3y agoThere are a lot of R users and it's a nice language you should try it sometimes.
- _Wintermute 3y agoAs an R user for nearly 15 years at this point: R isn't nice, it's an awful language, but it is very useful.
- doctaj 3y agoThe tidyverse has made it pretty “nice”.
- anaganisk 3y agoWhy build react, angular and all, when jQuery was just fine, why is there such a moment in Js to always build the next framework, seems like a waste of open source energy. ....something....something...requirement.. different approach...
- m2fkxy 3y agoThe mapmaking R ecosystem absolutely has been around for ages, and from a cartographer's point of view it is better suited at making actual maps than Python.
- smcl 3y agoAs a non-cartographer, but someone who loves maps (who doesnt?) and programming is there anything in particular that makes R more suitable than Python? Not trying to start a Python/R flame war, genuinely curious as an outsider if there's some secret sauce that R has but which Python lacks.
- m2fkxy 3y agoIMO it mostly boils down to good practices in symbology, projection, legend, scaling, etc. being better implemented and easy-to-use for the map maker. ggplot2 is an obvious heavy-weight, but other packages such as mapsf and tmap also are top notch in this regard. on the other hand, my general map making experience in Python has not been very pleasant when I had to work towards creating a map following acceptable cartographic practices, ie. anything beyond throwing data on a webmap layer with subpar legend and symbology.
- j7ake 3y agoThe secret sauce for R is that their statistical models/packages are cutting-edge, they have the best plotting library (ggplot2), and they have the best data wrangling packages (dplyr for tabular data).
- countrymile 3y agovery much this. I've spent years dabbling with other languages, nothing as ever been as clean as the tidyverse for data analysis
- b86754 3y agoInteresting, I’ve used both for years and have found R to be way more intuitive for data exploration and visualization. R looks different than most programming languages, but once it clicks it’s actually really nice.
- queens_ridge 3y agoggplot is the best! R has some fantastic packages especially for visualizations. And the community is great :)
- j7ake 3y agoYou're welcome to demonstrate why python ecosystem would be better for this analysis, otherwise you're making unsubstantiated claims.
- nologic01 3y agowhile I use Python far more than R (or Julia) I don't think that this is a particularly constructive comment. "More and better" is simply subjective and not substantiated. In fact detailed and objective comparisons of capabilities, performance etc between these ecosystems are sorely lacking not just in map-making but practially concerning every comparison. Still, the "waste of open source energy argument" is quite bit more complex and I'm frequently wondering about this. For sure this "waste" happens everywhere in open source. About the only thing that approaches some optimal level of efficiency is the Linux kernel. From there on, distributions, desktops, toolchains, apps, libraries etc. is the epitomy of chaos. This diversity creates resilience and a sort of competition for the survival of the fittest. The openness also facilitates fast diffusion and borrowing good ideas. But it is also true that open source resources are still scarce so development happens at maybe much lower speed than what would be possible if more coordination / less fragmentation was practiced.
- totetsu 3y agoSometimes I hold events, and I want to put a little map on the flyer. It's a real pain to manually deal with some SVG of a larger map area, and clip it and style it to fit the space. Does anyone know of any solutions like this for this kind of problem?
- honzabe 3y agoCould datawrapper be useful to you? It is easily configurable and the maps look great, I think. https://www.datawrapper.de/maps https://www.datawrapper.de/maps
- kqr 3y agoA couple of years ago I rendered some maps in QGIS using OpenStreetMap data. It was a complicated beast of functionality but if you learn the right 2 % of buttons it becomes a very competent tool for creating exactly the maps you need. It gives you the tools to show exactly the terrain features you care about (rivers, roads, streets, highways, trails, forests, buildings, railways, etc.) and you can choose to style them however you want.
- japanuspus 3y agoTotal agreement on QGIS: seems daunting at first, but if you know exactly what you want you can usually get there in half an hour. I have been using this a lot for scout activities and keep grandma-style notes of which buttons to push for a particular use-case. So awesome to be able to do things like contour-only maps and atlas along a route. For any Danes around: There is an official plugin from "Kortforsyningen" for QGIS, allowing you to pull all the high-quality public data directly into your maps.
- nilsbunger 3y agoMapbox Studio should be able to do this
- exp1orer 3y agoVaguely related, a few years ago I made a map of "how to drive from SF to NYC while passing through the minimum number of Republican-voting counties": https://github.com/louispotok/blue-road-trip https://github.com/louispotok/blue-road-trip
- michae4 3y agothat route follows an ancient coastline - https://starkeycomics.com/2021/06/11/how-a-coastline-100-million-years-ago-influences-modern-election-results-in-alabama/ https://starkeycomics.com/2021/06/11/how-a-coastline-100-mil...
- piceas 3y ago"How a coastline 100 million years ago influences modern election results in Alabama" With some maps of Cretaceous sediments, fertile Black Belt Prairie soil, farm size 1997, slave population 1860, black population 2010, and Election Results. A little bit about the soils from a different link: "The Black Belt is the only region in Alabama with extensive regions of alkaline soils (soil pH> 7.0). Early settlers discovered these clayey soils held more nutrients and were generally more productive than the sandier Coastal Plain soils. For this reason, many of the large, antebellum cotton plantations were located in the Black Belt region of Alabama and Mississippi. Black Belt soil color is dark because of the humus, or decomposed organic matter, that often coats the clay particles. However, severe erosion due to intensive farming practices removed much of the dark, rich topsoil." https://www.aces.edu/blog/topics/healthy-soils/alabama-soils-blackland-prairie/ https://www.aces.edu/blog/topics/healthy-soils/alabama-soils...
- pimlottc 3y agoThat is really interesting, thanks for sharing!
- kristopolous 3y agoDid you traverse this? Maybe return through maximally republican counties and compare?
- EddieEngineers 3y agoI’m driving SF to NY next week so will definitely spend some time trying this out to share with family!
- avtolik 3y agoI did something similar in Go for a big sailing trip this year. Just haven't had the time and energy to write a blog post about it. https://j.avtolik.net/journey/2 https://j.avtolik.net/journey/2
- avest 3y agoLooks neat, is the code open to look at somewhere?
- avtolik 3y agoSorry, this is part of my effort of learning Go and is also a WIP. So I am not yet comfortable sharing the code. I can share the libraries I used: - go html/template for the front-end - github.com/twpayne/go-gpx for parsing the gps tracks - github.com/fogleman/gg for drawing the images - github.com/dsoprea/go-exif/ for reading the exif of the photos, so I can show where are they taken on the route map
- flaie 3y agoThank you for sharing this was really nice and interesting.
- JEDI-HACKER 3y ago[dead]
- denysvitali 3y agoThe only thing I don't like about OSRM (the public facing version, not sure if the Docker one has this limitation) is that the route planning is limited in the number of waypoints. I'm planning a trip to the west coast and have 50 POIs (coordinates) collected from Wanderlog that I want to visit. I just run a small TSP algorithm over that list and have an ordered collection of points for which I want to calculate the route for. Unfortunately it seems like OSRM doesn't like my 50+ waypoints, thus I can't really plot the trip. I'll probably give it another try locally, and then make a PR. It also looks like the only way to get a route across waypoints is to make a GET request, so just imagine how long the request path will be with 50 points :'( That calls out for a new POST endpoint.
- Doctor_Fegg 3y agoThat’s the public instance. It’s a runtime flag to osrm-routed so if you set up your own instance, you can configure it how you like. (Or use the Node or upcoming Python bindings.)
- denysvitali 3y agoStill, most likely passing 50+ waypoints in the URI might cause other issues
- Doctor_Fegg 3y agoI can't speak for the most recent version, but I regularly pass 200+ waypoints to a fork of OSRM 4.9 and it works fine. If you were to use the Node/Python bindings and hence avoid any webserver limitations you should be ok.
- denysvitali 3y agoAwesome, thanks!
- schubart 3y agoRelated: The "Here Dragons Abound" blog [1] deals with pleasant layout of generated maps. [1] https://heredragonsabound.blogspot.com https://heredragonsabound.blogspot.com
- muhblah 3y agoTo the author of this blog post (if he should read this): This is amazing. Thanks so much for sharing. And it’s even more amazing by noticing the fact that you and your wife go the extra mile and make it an adventure for your kids! F*%k screens (iPads/iPhones). This kind of attention and adventure is what kids really need and deserve (imho). I’m a proud father of 3 and I can imagine the joy and curiosity of your kids on this trip. I wish you as family all the best and an unforgettable time with amazing and memorable moments!
- nonethewiser 3y agoYeah the journal idea made me smile. Very thoughtful and constructive parenting.
- tomtomistaken 3y agoI found this repository to make storymaps with Google Sheets and Leaflet, that could be a nice addition: https://github.com/HandsOnDataViz/leaflet-storymaps-with-google-sheets https://github.com/HandsOnDataViz/leaflet-storymaps-with-goo...
- standing_user 3y agoVery Nice! I will try it
- codethief 3y agoSome of my friends & family use Polarsteps.com to share their routes (and photos), whose UI is comparatively slick. I'm afraid of the lock-in, though, and would be much more interested in an open-source solution. Does anyone happen to know any?
- j7ake 3y agoFantastic post! But keeping this "limited iPads/electronics" policy for the kids: is the idea to print out these maps and put them into a journal for them to annotate on?
- eddyg 3y agoReally informative post on how to do this "by hand"! I use https://trips.furkot.com https://trips.furkot.com (which is free) for this kind of trip planning. It is fantastic to determine how much stuff you can fit in a day, taking into account when you want to start/end your day, driving time, stops for food, time spent at any road-side attractions, overnight stays, ticketed events (to ensure you arrive on time), etc. It's an incredible resource that seems to "fly under the radar".
- lh7777 3y agoThanks for this. I've been using Roadtrippers, which is OK but full of intrusive ads even if you pay for the Pro subscription. Furkot looks much better.
- queens_ridge 3y agoAwesome thanks for sharing. I've worked with OSM data extensively but didn't know about the routing possibilities shown here. Will have to try soon!
- nico 3y agoTo the author: great write up and cool project Would have loved to see the end result at the top of the article instead of having to scroll all the way down to the bottom for it Thank you
- slantaclaus 3y agoI hope when you talk about "days", those are just travel days. Be sure to stop a while somewhere nice and explore if you have time. As Rick Steves says, if you can't justify staying somewhere for at least one night, it might be a good idea just to keep moving!
- mc32 3y agoThis reminds me of a Bing (MSN?) maps plug-in a while ago that was built by, I think, an Indian guy who went over to MS, which would plot a summarized route map from point A to point B where the main roads in your route were labeled, esp where you had to turn or get on a diff road. This was before phones with GPS came about. The roads looked somehwat like chicken scratch (straight, not many curves). Like if you were mapping directions in sand/dirt with a stick in explaining to someone how to get some place. Ah, yes, it was Linedrive: https://somethingaboutmaps.wordpress.com/2011/03/08/remembering-linedrive/ https://somethingaboutmaps.wordpress.com/2011/03/08/remember...
- sudo_navendu 3y ago[dead]
- JustSomeNobody 3y agoWe did a several thousand mile road trip a couple years ago. We planned it out using various online tools and pen and paper. Will have to look into doing something like this the next time. The kiddos got to see a LOT of really cool things. They had a blast.
- jcpst 3y agoCool, like a DIY AAA TripTik (anyone else used to pick those up for trips?)