Code Monkey home page Code Monkey logo

bloch's Introduction

Bloch - Simplify linework in polygonal geographic datasources.

DESCRIPTION

    Inspired by Matthew Bloch's MapShaper thesis (http://mapshaper.org), Bloch can
    load OGR-compatible data sources and simplify the linework while preserving
    topology. The simplify() method accepts tolerances in map units, so
    simplification can be performed by known amounts with predictable outcomes.
    
    Dependencies include Warmerdam (http://trac.osgeo.org/gdal/wiki/GdalOgrInPython)
    and Gillies (http://trac.gispython.org/lab/wiki/Rtree, http://trac.gispython.org/lab/wiki/Shapely).
    
    Example usage:
    
      # Load a data file into a Datasource instance.
      datasrc = load('input.json')
      
      # Simplify the geometry.
      datasrc.simplify(500)
      
      # Save it out to a new shapefile.
      save(datasrc, 'output1.shp')
      
      # This will throw an error, because 250 < 500.
      datasrc.simplify(250)
      
      # Simplify the geometry more.
      datasrc.simplify(1000)
      
      # Save it out to a new GeoJSON file.
      save(datasrc, 'output2.json')

CLASSES
    Datasource
    
    class Datasource
     |  Store an exploded representation of a data source, so it can be simplified.
     |  
     |  Methods defined here:
     |  
     |  __init__(self, srs, geom_type, fields, values, shapes)
     |      Use load() to call this constructor.
     |  
     |  simplify(self, tolerance, verbose=False)
     |      Simplify the polygonal linework.
     |      
     |      This method can be called multiple times, but the process is
     |      destructive so it must be called with progressively increasing
     |      tolerance values.

FUNCTIONS
    load(filename, verbose=False)
        Load an OGR data source, return a new Datasource instance.
    
    save(datasource, filename)
        Save a Datasource instance to a named OGR datasource.

bloch's People

Stargazers

 avatar

Watchers

 avatar  avatar

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.