Skip to content

Commit

Permalink
Merge pull request #20 from loicgasser/bytesio
Browse files Browse the repository at this point in the history
Bytesio in doc, speedups and bump
  • Loading branch information
loicgasser authored Apr 4, 2017
2 parents fddcd08 + 784858d commit d65d36d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
# built documents.
#
# The short X.Y version.
version = u'0.3'
version = u'0.4'
# The full version, including alpha/beta/rc tags.
release = u'0.3alpha'
release = u'0.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 5 additions & 5 deletions doc/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ This operation will write a local file representing the terrain tile.
If you don't want to create a physical file but only need its content, you can use:

>>> tile = encode(geometries, bounds=bounds)
>>> content = tile.toStringIO(gzipped=True)
>>> content = tile.toBytesIO(gzipped=True)

This operation will create a gzipped compressed string buffer wrapped in a `cStringIO.StringIO` instance.
This operation will create a gzipped compressed string buffer wrapped in a `io.BytesIO` instance.

To define a water-mask you can use:

Expand Down Expand Up @@ -147,7 +147,7 @@ Using the `requests module`_, here is an example on how to read a remote terrain
The you won't need to decompress the gzipped tile has this is performed automatically
in the requests module.

>>> import cStringIO
>>> from io import BytesIO
>>> import requests
>>> from quantized_mesh_tile.terrain import TerrainTile
>>> from quantized_mesh_tile.global_geodetic import GlobalGeodetic
Expand All @@ -156,7 +156,7 @@ in the requests module.
>>> [west, south, east, north] = bounds = geodetic.TileBounds(x, y, z)
>>> url = 'http://assets.agi.com/stk-terrain/world/%s/%s/%s.terrain?v=1.16389.0' % (z, x, y)
>>> response = requests.get(url)
>>> content = cStringIO.StringIO(response.content)
>>> content = BytesIO(response.content)
>>> ter = TerrainTile(west=west, south=south, east=east, north=north)
>>> ter.fromStringIO(content)
>>> ter.fromBytesIO(content)
>>> print ter.getVerticesCoordinates()
7 changes: 7 additions & 0 deletions quantized_mesh_tile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
from .topology import TerrainTopology


# Enable Shapely "speedups" if available
# http://toblerity.org/shapely/manual.html#performance
from shapely import speedups
if speedups.available:
speedups.enable()


def encode(geometries, bounds=[], autocorrectGeometries=False, hasLighting=False,
watermask=[]):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
requires = ['shapely', 'numpy']

setup(name='quantized-mesh-tile',
version='0.3alpha',
version='0.4',
description='Quantized-Mesh format reader and writer',
author=u'Loic Gasser',
author_email='[email protected]',
Expand Down

0 comments on commit d65d36d

Please sign in to comment.