I’ll use geojson to generate data for a route I walk so that it can later be used in mapping the route using folium. Arriving at geojson you’ll see there are two panes: the pane on the left is the map who starting point is zoomed out to display in mercator projection the visible landmass of the earth. The pane on the right will display the json data for the locations you select on the map pane.
I live in Brooklyn and routinely walk around Prospect Park so I’ll take a look at that route. You can zoom in and out like google maps and view in mapbox setting:
Or Open Source Maps:
Once you’ve zoomed in to the relative area your trying to plat data for, you’ll use the tool on the right side of the map pane and select the line icon to start drawing your route:
Once you’ve selected the line tool, trace the route by clicking to initiate the line and periodically along segments of the route, clicking again to drop the path. Since it’s easier to see the path I walk using open maps, that what I’ll use:
You can see the white dots along the segment of the route you’ve dropped and with each additional segment, you’ll see a popup box showing the distance covered so far. I’ll keep going so the whole route is traced:
Once you’ve completed the route, double click the final point to enclose it and the route will be traced in black.
You’ll see that the righthand pane has been populated with the latitude and longitude coordinates in a json format. Now I’ll use that json data when I go back to my jupyter notebook. If you haven’t already installed folium you must do so:
!pip install folium
I’ve already done so and my requirements are satisfied so I’ll import folium and create a map object:
Here I am using a method “Map” that belongs to the folium library and assigning the object to the variable “map”. The map method takes two arguments: location for the GPS coordinates and zoom_start which yields the map at a particular size. I used zoom_start = 14 but you can use whatever fits your notebook best.