From b6359772b12d5d931b286e1112670d664fb5a46a Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Sat, 31 Mar 2007 21:14:22 +0000 Subject: [PATCH] gis: module for interfacing with GEOS routines. git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@4882 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/geos/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 django/contrib/gis/geos/__init__.py diff --git a/django/contrib/gis/geos/__init__.py b/django/contrib/gis/geos/__init__.py new file mode 100644 index 0000000000..b3b879832c --- /dev/null +++ b/django/contrib/gis/geos/__init__.py @@ -0,0 +1,19 @@ +from geos import geomFromWKT, geomToWKT, geomFromHEX, geomToHEX + +def hex_to_wkt(hex): + "Converts EWKBHEX into WKT." + return geomToWKT(geomFromHEX(hex)) + +def wkt_to_hex(wkt): + "Converts WKT into EWKBHEX." + return geomToHEX(geomFromWKT(wkt)) + +def centroid(hex): + "Returns the centroid of the geometry (given in EWKBHEX)." + center = (geomFromHEX(hex)).getCentroid() + return geomToWKT(center) + +def area(hex): + "Returns the area of the geometry (given in EWKBHEX)." + return (geomFromHEX(hex)).area() +