Round-tripping geometries through hex-encoded binary
====================================================

Hex-encoded binary is the PostGIS geometry representation, and so this is a
test of the ability to store Shapely geometries in PostGIS.

Point
-----

  >>> from shapely.geometry import Point
  >>> point = Point(0.0, 0.0)
  >>> from binascii import a2b_hex, b2a_hex
  >>> x = b2a_hex(point.wkb)
  >>> from shapely import wkb
  >>> shape = wkb.loads(a2b_hex(x))
  >>> shape # doctest: +ELLIPSIS
  <POINT (0 0)>

LineString
----------

  >>> from shapely.geometry import LineString
  >>> line = LineString([(0.0, 0.0), (1.0, 1.0)])
  >>> x = b2a_hex(line.wkb)
  >>> shape = wkb.loads(a2b_hex(x))
  >>> shape # doctest: +ELLIPSIS
  <LINESTRING (0 0, 1 1)>

Polygon
----------

  >>> from shapely.geometry import Polygon
  >>> polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)])
  >>> x = b2a_hex(polygon.wkb)
  >>> shape = wkb.loads(a2b_hex(x))
  >>> shape # doctest: +ELLIPSIS
  <POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))>

Polygon with hole
-----------------

  >>> polygon = Polygon([(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)], [[(0.1,0.1), (0.1,0.2), (0.2,0.2), (0.2,0.1)]])
  >>> x = b2a_hex(polygon.wkb)
  >>> shape = wkb.loads(a2b_hex(x))
  >>> shape.wkt # doctest: +ELLIPSIS
  'POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0), (0.1 0.1, 0.1 0.2, 0.2 0.2, 0.2 0.1, 0.1 0.1))'

