Skip to content

Export Open Street Map tiles, convert to OBJ for importing to 3D slicing software

License

Notifications You must be signed in to change notification settings

silverXnoise/osm-to-3dprint

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osm-to-3dprint

Export OpenStreetMap (OSM) tiles, convert them to STL format, and import them directly into your 3D slicing software.

  • building height data may be missing in certain cities, so check for other height attributes in the osm data
    height_attrs = ['height', 'building:height', 'building:levels']

Benefits

  • free for commercial usage (MIT License)
  • Larger Area Exports: Unlike Cadmapper, which limits free exports to 1 square kilometer, osm-to-3dprint allows you to export much larger areas without any cost.
  • Optimized for 3D Printing: The exported STL files are designed to have no non-manifold edges, which ensures that the model is ready for 3D printing without the need for repairs.
  • Small File Size: Despite covering extensive areas, the exported STL files are compact in size. For example, the entire downtown area of San Francisco (buildings.stl) is around ~17.5 MB (around 8.86 square kilometers).
  • Relatively Fast - less than one minute to run main.py and get a city file for any given city.

Features

  • Customizable Parameters: Easily adjust parameters such as target size, maximum building height, and base thickness to suit your specific needs.
  • Ready for Slicing: The generated STL files are optimized for 3D printing, ensuring minimal preparation time and reducing potential errors.

Installation

python3 -m pip install -r requirements.txt

This project relies on several libraries, including OSM, overpass-api, osmnx, shapely, trimesh, and numpy-stl.

Sample Usage

Adjust the GPS coordinates to define the bounding box of the area you wish to export:

# Example bounding box: min_lat, min_lon, max_lat, max_lon
bbox = (37.8049, 37.7749, -122.3894, -122.4194)  # San Francisco example
bbox = (33.7756, 33.7405, -84.3790, -84.4156)  # Approximate bounding box for downtown Atlanta
bbox = (40.9176, 40.7003, -73.9067, -74.0122)  # Approximate bounding box for Manhattan, New York

You can also modify parameters like target_size, max_height, and base_thickness to customize the export.

Run the script: python3 main.py

Future Improvements

  • Additional Details: We're planning to include streets and other detailed features in future versions.
  • Performance Enhancements: We aim to optimize the slicing software time, as it currently takes longer than expected for larger models.

Example Output

Here's a sample of San Francisco visualized in Bambu Studio: image

Here's a sample of Atlanta in Bambu Studio: image

Here's a sample of Manhatten, New York: image

Acknowledgments

Special thanks to ChatGPT by OpenAI for assisting in the development of the codebase.

About

Export Open Street Map tiles, convert to OBJ for importing to 3D slicing software

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%