Giter VIP home page Giter VIP logo

dxfmaps's Introduction

dxfmaps

Python module to generate vector maps from ESRI Shapefiles with the purpose of cutting custom maps in CNC controlled machines(e.g. Laser cutters or CNC milling machines).

Example

Features

  • Convenient SVG and DXF formats to import into CNC software for processing and cut.
  • Specify the desired width or height of the final SVG/DXF.
  • Include label for each country in separate layers of the DXF file.
  • Generate a vector map of all countries in a continent by just specifying the name of the continent.
  • Reducing the number of points in the data by simplifying polygons.
  • Implement greatest rectangle(in area) contained in a polygon
  • Generate a map of all the provinces/states in a country specifying the name of the country.

Installation

Install with:

git clone https://github.com/dmartzol/dxfmaps.git
cd dxfmaps
pip install -e .

Requirements

  • pyshp - Library for reading ESRI Shapefiles
  • Shapely - Manipulation and analysis of geometric objects
  • ezdxf - Creation and manipulation of DXF drawings

Usage and examples

from dxfmaps.map import Map
from dxfmaps.utils import WORLD_COUNTRIES
from dxfmaps.projections import *


def main():
    map = Map(WORLD_COUNTRIES, continent="europe")
    map.filter_by_area(area_limit=1.0)
    map.simplify(tolerance=.015)
    map.project(MERCATOR)
    map.translate_to_center()
    map.scale_to_width(1000)
    map.add_labels()
    map.to_png(filename='europe.png', stroke_width=2.0)
    map.to_svg()
    map.to_dxf()


if __name__ == "__main__":
    main()

TO DO

  • Implement Azimuthal and Winkel Triple and Mercator projections.
  • Implement smaller buffered map for back support.
  • Add country names.
  • Implement PNG support.
  • Add credits(Natural Earth logo, etc).
  • Comment code.
  • Add support for other data sources(.gov)
  • Calculate adequate tolerance for method 'simplify'.
  • Move unused functions to deprecated
  • Implement imperial units?

License

This project is licensed under the MIT License

Acknowledgments

  • Built using data from Natural Earth, using the maps for countries and states/provinces.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.