Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.2 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Science and Engineering > Geographical

    descartes 1.0

    Download button

    No screenshots available
    Downloads: 356  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Sean Gillies | More programs
    BSD License / FREE
    April 27th, 2010, 13:28 GMT
    ROOT / Science and Engineering / Geographical

     Read user reviews (0)  Refer to a friend  Subscribe

    descartes description

    Use geometric objects as matplotlib paths and patches

    descartes is a Python module that allows you to use Shapely or GeoJSON-like geometric objects as matplotlib paths and patches.

    Example:

    from matplotlib import pyplot
    from shapely.geometry import LineString

    from descartes.patch import PolygonPatch

    line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])

    fig = pyplot.figure(1, figsize=(7.5, 3), dpi=180)

    # 1
    ax = fig.add_subplot(121)

    dilated = line.buffer(0.5)
    patch1 = PolygonPatch(dilated, facecolor='#99ccff', edgecolor='#6699cc')
    ax.add_patch(patch1)

    x, y = line.xy
    ax.plot(x, y, color='#999999')

    ax.set_xlim(-1, 4)
    ax.set_ylim(-1, 3)

    #2
    ax = fig.add_subplot(122)

    patch2a = PolygonPatch(dilated, facecolor='#cccccc', edgecolor='#999999')
    ax.add_patch(patch2a)

    eroded = dilated.buffer(-0.3)

    # GeoJSON-like data works as well

    polygon = eroded.__geo_interface__
    # >>> geo['type']
    # 'Polygon'
    # >>> geo['coordinates'][0][:2]
    # ((0.50502525316941682, 0.78786796564403572), (0.5247963548222736, 0.8096820147509064))
    patch2b = PolygonPatch(polygon, facecolor='#99ccff', edgecolor='#6699cc')
    ax.add_patch(patch2b)

    ax.set_xlim(-1, 4)
    ax.set_ylim(-1, 3)

    fig.subplots_adjust(0.0, 0.0, 1.0, 1.0, 0.1)
    fig.savefig('buffering.png')


    See also: examples/patches.py.


    Product's homepage

    Requirements:

    · Python
    · Matplotlib
    · NumPy
    · Shapely

      


    TAGS:

    geometric objects | matplotlib paths | Python library | geometric | objects | matplotlib

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM