Elk with grasshopper

From TOI-Pedia


Figure 1. Generated Elk model in Rhino

Elk is a handy plugin that allows you to import OSM data to Rhino via grasshopper. Generating clean urban data in separated layers in a couple of minutes.

Exporting maps from OpenStreetMaps (OSM) allows you to easily make a background map in illustrator. This tool could be handy for making diagrams, concept maps and other project related material. Exporting Rhino views to illustrator is discussed in Rhino to Adobe Illustrator.
This tutorial focuses on the use of the Elk (1 and 2) plugin for grasshopper.

Elk plugin

Figure 2. Two versions of Elk in extra tab of grasshopper
Figure 3. Unblocking Elk with windows properties

Currently there are two versions of Elk, 2 and 3. For most projects Elk 2 will be enough but it is always recommend to download both versions. The main difference between the two versions is that version 2 is a bit more user friendly, while the first version is easier to assimilate in more extensive grasshopper scripts.

Installing Elk 1 and 2:

Step 1: Install the Elk plugin for Rhino (https://www.food4rhino.com/app/elk). Download Elk 2.2.2 and 0.3.1 and place the download files here: C:\Users\#your username#\AppData\Roaming\Grasshopper\Libraries\. Before unpacking the Elk 2.2.2 zip-file right click on the file and select properties. Make sure to check the unblock property under attributes. Click on apply and extract the file. For some users it is also necessary to unblock the elk3.gha file, this is also done through properties. Now Elk is ready to use and can be found under the Extra tab of grasshopper.

Step 2: Go to the OSM website (openstreetmap.org) and go to your desired location. Click on Export and download your map. If your map is too big you will get a notification and you need to select a smaller area. Download the .osm file and place it in your project folder.

Using Elk 1

Figure 4. Example script of OSM to Rhino with the Elk tool.

Step 1: Go to grasshopper and make a new script. As seen in figure 4, place the File Path tool and link it to your .osm file location (right click). Next place the Location component of the Elk tool, connect the File Path to the Location component.

Step 2: Now you can filter out the specific data you want in your Rhino model. Use the Highway, Major and Minor road tools of Elk to separate them by function (this could be handy if you want to have these roads as different layers in your Rhino or Illustrator file). The output of these tools give vertices that can be transformed to lines with the PolyLine tool.

Step 3: Add the GenericOSM tool to add other elements to your map such as buildings, make sure to connect the right key value to the tool. For a full list of keys go to: https://wiki.openstreetmap.org/wiki/Map_Features. To finalize the tool connect the PolyLine tool again.

Step 4: Bake the different elements. It could be handy to give all elements a different layer such as; buildings, highways, roads, etc...

Using Elk 2

Figure 5. Example script of OSM to Rhino with the Elk 2 tool.
Figure 6. Selection menu of OSM tool
Figure 7. Sub-type menu of the OSM tool
Figure 8. Example of sub-type menu of the Highway type with Show Individual Input selected
Figure 9. Output result of example shown in figure 7

Step 1: Just as in Elk 1 create a new grasshopper script and place the File Path tool and link this with your .osm file. Secondly, place the Location tool of Elk 2. Link these two tools.

Step 2: As seen in figure 5, you can place the Topography- and the OSM data (element) tool. It is important to connect both the OSM and File output of the Location tool to the same inputs in the element components. The Topography component works as any other tool and gives immediately the output. The OSM tool however, can be tweaked to your liking, as described in the following steps.

Step 3: Figure 6 and 7 show the process of selecting different types (or elements, see Elk 1) and sub-types that are available. The selection menu is enabled by right clicking on the middle of the OSM tool. As seen in figure 6 the builing type also gives the possibility to create 3D breps as an output, this function however, is not always available (depends on city OSM data).

Step 4: As described in step 3 you can select the sub-types of a specific type from e.g. Highway. Figure 7 shows the different sub-types that are available, in this example the Show Individual Input check box is selected. This will create additional output slots which can be handy, see figure 9.

Exporting your Rhino file to Illustrator

Follow this tutorial to understand the steps required to export your Rhino drawing to Adobe Illustrator.

Export from OSM website to Illustrator

Using this export option only results in a very basic .pdf map that is not as customizable as the other options.

Step 1: Go to the OMS website: https://www.openstreetmap.org/, and search for your preferred export area.

Step 2: Click on Share (right tab) and select your area with the Set Custom Dimensions tool. Take note that you can also alter the scale of your export. Finally, set the format to .pdf and download your image.

Step 3: Open your .pdf file with Adobe Illustrator and start editing. All elements of your map are placed in a separate layer.

Useful links and video tutorials

OSM key value list: https://wiki.openstreetmap.org/wiki/Map_Features
Using Elk 1 to export OSM: https://www.youtube.com/watch?v=cNjxuwnJyzk
Using Elk 2 to export OSM: https://www.youtube.com/watch?v=EJ5_0dQiKPc
Exporting from OSM website: https://www.youtube.com/watch?v=QJijw_MBZv0
Other tutorial: https://wiki.openstreetmap.org/wiki/Exporting_to_Adobe_Illustrator

Personal tools