OpenStreetMap: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
Line 11: Line 11:
Purpose of this article (for now): Extracting information for laser cutting and 3D printing. At some point, if something of interest emerges, sections will be made into stand-alone articles, e.g. the Maperitive section - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 20:39, 15 March 2017 (CET)
Purpose of this article (for now): Extracting information for laser cutting and 3D printing. At some point, if something of interest emerges, sections will be made into stand-alone articles, e.g. the Maperitive section - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 20:39, 15 March 2017 (CET)


== Mapertitive ==
== OpenStreetMap Data for laser cutting and 3D printing ==


Maperitive is a FREE desktop application for drawing maps based on OpenStreetMap and GPS data. You can define what gets on the map and how it is painted. You can also export these maps into bitmaps and SVG files and print them. ([http://maperitive.net/ Maperitive home page], March 2017). The application is programmed in Net and needs Net 4.0 installed on Windows or the latest Mono under Linux.
* Since OpenStreeMap data includes structured information it can be extracted to various formats suitable for laser cutting and 3D printing.


We are exploring this since it can export SVG layers that could be useful for [[laser cutting]] and [[3D printing]]
For the moment, read:
 
* [[Maperitive for laser cutting and 3D printing]]
In this context, one needs to know the following:
* By default, Maperitive will display a tiled bitmap map, called OSM Mapnik (the same that is used on the [http://www.openstreetmap.org/ OSM main map site])
* You will have to replace this map by vectorized maps. According to the [http://maperitive.net/docs/FAQ.html FAQ], 
{{quotation|Maperitive rendering rules work on vector data, like OSM and GPX files. So you first need to load a vector file into Maperitive to see the actual rules in action. You can use File | Open Map Sources menu command to open one or more map sources. After loading, make sure you turn off the Web map layer (you can see the layers list in the bottom right tool window)}}
 
=== Installation under Ubuntu ===
 
Prerequisites
* Mono (a .Net implementation)
There are many mono ubuntu packages and I frankly do not know which are needed, I just got the complete set (but it's not that huge)
sudo apt-get install mono-complete
 
Download as zip file from
[http://maperitive.net/download/Maperitive-latest.zip Dowload the latest version]
unzip ...
cd Maperitive
chmod a+x Mapertive.sh
./Maperitive.sh &
 
Exporting a map to SVG for either Illustrator or Inkscape
Menu tools -> Export to SVG
 
=== Create contours for laser cutting ===
 
'''Setting your zone of interest'''
* Zoom out then in
* Menu View -> Set home location
* You now can export what you see. The result will be a tiled SVG file. Each tile is *.png file. Only the coordinates and the scale are SVG. This is not too useful for laser cutting or 3D printing.
 
'''Loading contour data'''
 
Read the [http://braincrunch.tumblr.com/post/9921938947/maperitive-tutorial-a-hiking-web-map-in-ten-easy Maperitive Tutorial: A Hiking Web Map In Ten Easy Steps]. In summary the steps are the following:
 
* Right click; Place Geometry bounds here
* Adjust the rectangle
* Get NASA SRTM DEM data: Menu Tools -> Generate Hillshading (Igor)
* Turn off the Web Map (OSM Mapnik) in the Map source at bottom right.
* Generate the relief contours: Menu Tools -> Generate Relief Contours.
 
Below are my exploration with the Salève, the "house mountain" of Geneva, its base 15 min from downtown.
<gallery widths="300" heights="400">
saleve-selection.png|Salève Selection in Maperitive
saleve-contour-lines.png|Salève. Just the contour lines
saleve-inkscape.png|Salève. Tedious contour repairing work.
</gallery>
 
'''Preparing for Laser cutting'''
 
You now can export to SVG and laser cut the contour lines. This is very tedious work. Consider using a tool that can automatically slice a 3D model and start from that.
 
* Untick the image in the Map Sources (unless you want to use it for engraving)
* Zoom in or out. Details of output will match zoom level !
* Menu Tools -> Export to SVG
* Open in a SVG editor like Inkscape
** Get rid of layers you do not want
** Lock all layers except the contour layer
** Get rid of contours along the edges (optional)
** Repair open lines. Typically you could edit the path in the following way: (1) Select the path, (2) Add a node in one of the 4 corners. (3) Link this node to the dangling ends. You also must close the lines that include an altitude number. Displace the number itself inside an area so that it can be engraved.
** Arrange each contour line in a different spot (if the model is complex, consider adding a number, else find an otherwise logical arrangement
** Make the lines "hairline" and select a color you like
** Send to laser cutter.
 
Of course this only works with small areas !
 
'''Variant that adds roads'''
* Download the OSM Data (in particular roads): Map->Download OSM Data (Overpass API)
* You could export again in SVG, but the cleanup work required will be quite impressive, unless you really do a very small area. (not yet tested)
'''Saving an OSM map'''
 
Consider saving an OSM map locally. Do to so, use the export-osm command
export-osm file=output/saleve.osm
 
=== Creating contour creation scripts ===
 
Instead of using the menu, you could write a script. Firstly, learn how to modify the parameters. In particular, read [http://maperitive.net/docs/Commands/ExportSvg.html Export-SVG Command]
 
* In the '''Assistant Window''' search for the command, e.g. export-svg
* Double click on it. You will see <code>export-svg</code> in the Command prompt (bottom of main window)
* Select various command parameters and play
 
You then can combine these into a script that you can load and run in the file menu. The following example will select an area south and east of Geneva, i.e. the Salève mountain and then export the contours to SVG
 
File ''saleve.mscript'':
<source lang="bash">
// This script will produce a 100m contour map of the Salève,
// the little house mountain south of Geneva (hiking, climbing, paragliding)
// Made by Daniel K. Schneider, TECFA, University of Geneva, March 2017
 
// loads the default map (this is done automatically already)
// add-web-map
 
// test
define font-size:8:8;12:12
 
// identifies the area of interest (lower left and upper right corner)
set-geo-bounds 6.075,46.035,6.24,46.183
 
// identifies what will be exported. Same coordinates as above.
set-print-bounds-geo 6.075,46.035,6.24,46.183
 
// Center somewhat the map so you can see
move-pos x=6.15 y=46.1
 
// Not necessary, but allows to see better.
generate-relief-igor color=gray
 
// generate contours (display will adjust to zoom level, see next)
generate-contours
 
// For laser cutting, make sure not to have too many contours
zoom-map-scale 150000
 
// Optional. Kill the bitmaps. In principle it should be the first map source in the list
remove-source index=1
 
// Export using a scale. Do not set a zoom here, unless you want to override the zoom map scale.
export-svg file="output/saleve/saleve.svg" compatibility=Inkscape scale=3 copy-images=true
 
// Optional. Load the bitmap we again.
add-web-map
</source>
 
=== Creating 3D models ===
 
Warning: This is not a very good way to create terrain model. Since Maperitive uses standard STRM DEM data, there are easy ways to get a model with the same type of data, e.g. read [[3D printing of digital elevation models‎‎]]  
 
'''(1) Export a *.dae file'''
 
Mapertive allows exporing a 3D model in Collada format
 
An example would be:
  export-3d output-dir="output/saleve3D" ele-ratio=2 map-scale=50000
Setting a lower map-scale than 1:100'000 doesn't seem to have any effect, i.e. the original DEM data is not too precise.
 
However, you could lower the resolution. The simplest solution I found was the  tin-error parameter
  tin-error=10
Script that defines an area and loads OSM data:
<source lang="bash">
// This script will produce a 100m contour map of the Salève,
// the little house mountain south of Geneva (hiking, climbing, paragliding)
// Made by Daniel K. Schneider, TECFA, University of Geneva, March 2017
 
// loads the default map (this is done automatically already)
// add-web-map
 
// get OSM data (uncomment the first time)
// download-osm-overpass
// export-osm file="output/saleve.osm"
 
// Load an OSM file
load-source file="output/saleve.osm"
 
// identifies the area of interest (lower left and upper right corner)
set-geo-bounds 6.075,46.035,6.24,46.183
 
// identifies what will be exported. Same coordinates as above.
set-print-bounds-geo 6.075,46.035,6.24,46.183
 
// Center somewhat the map so you can see
move-pos x=6.15 y=46.1
 
// Export with 200% extra elevation and the max meshpoints
export-3d output-dir="output/saleve3D" ele-ratio=2 map-scale=50000 mesh-points=100000
</source>
 
'''(2) Import to sketchup and export'''
 
If opened in Meshlab, the file looks like a bird's nest. There is probably a filter that could fix this, but I don't know which one. Anyhow, opened in sketchup, the model looks OK, but is not printable as is since it only represents a hilly surface.
 
* Use the 3Dprinting millimeters template (before doing anything) and not a m(eter) Model !
* Get rid of the Makerbot propaganda if you can...
* File->Import
* Options: Tick <code>Merge Coplanar Faces</code>, You can untick the validation if it takes too much time
* Select the *.dae file.
* Click in the scene (otherwise the object never will be there ...) then hit ESC
* Menu Camera: Parallel projection
 
[[File:saleve-sketchup.png|600px|none|thumb|Importing a *.dae file to sketchup]]
 
This model is not printable yet. It is not solid and not a box. You now can add a box in Sketchup or else extrude the 2D terrain to make it volume. Another solution is to use an other tool. Since I find Sketchup difficult to use for such things, I strongly recommend buying the $20CAN AccuTrans Tool.
* Read [https://www.instructables.com/id/3D-Printed-Terrain-From-Google-Maps-With-SketchUp/ 3D Printed Terrain from Google maps with Sketchup], if you want to do this in Sketchup. Even then, I am not sure that it is possible to handle terrains that are not level at the bottom.
 
In either case, export the model again
* File->Export 3D model
 
''' (3) Add a bottom with AccuTrans'''
 
* Get [http://www.micromouse.ca/ Accutrans] if you do not already own it.
* Open the *.dae file
* Select <code>Tools -> Extrude Pseudo 2D Surface</code>
** Tick "Flat Bottom"
** Add thickness that represents maybe 5-10% of the total Z height, e.g. 50000 for the Swiss top map.
** Click on <code>Extrude</code>.
 
(Optional) You also could use Accutrans to scale the model to the right dimensions and positions and rotate
* Tools_1 -> Adjust object parameters
** Click on <code>Calculate scale</code>. Select the larger x or y value, then enter a desired result, e.g. '''200''' because your printer will want millimeters and your print bed is not much bigger than that. You always can fine tune in the STL editor.
** Hit the <code>scale</code> button
** Rotate 90deg around the X axis
** Tick <code>Set Min at 0.0.0</code>
** Click '''OK''' at the bottom.
 
[[File:accutrans-from-maperitive3D-dae.png|none|600px|thumb|3d *.dae terrain model with a bottom]]
 
'''Export to STL'''
* Save as, select STL
 
'''(4) Import to Netfabb (or another STL tool)'''
 
* Scale the model, e.g. I once had to divide by 2000 (scale = 0.0005)
* Move to origin (the model will sit in some outerspace area !)


== Links ==
== Links ==

Latest revision as of 12:51, 17 March 2017

Draft

Introduction

OpenStreetMap is an initiative to create and provide free geographic data, such as street maps, to anyone. The OpenStreetMap Foundation is an international not-for-profit organization supporting, but not controlling, the OpenStreetMap Project. It is dedicated to encouraging the growth, development and distribution of free geospatial data and to providing geospatial data for anyone to use and share. (OMSFoundation, March 2017)

OpenStreetMap is available through the official[openstreemap.org web application], but can be found in many applications, including may phone applications.

Since OpenStreetMap uses a well documented data structure, it is used for creating all sorts of map-based application on all sorts of devices.

Purpose of this article (for now): Extracting information for laser cutting and 3D printing. At some point, if something of interest emerges, sections will be made into stand-alone articles, e.g. the Maperitive section - Daniel K. Schneider (talk) 20:39, 15 March 2017 (CET)

OpenStreetMap Data for laser cutting and 3D printing

  • Since OpenStreeMap data includes structured information it can be extracted to various formats suitable for laser cutting and 3D printing.

For the moment, read:

Links

The online map
  • OpenStreeMap. The online map as web application (not the same thing as the OpenStreeMaps
Introductions (official)
Using (official)