Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

gis: module for interfacing with GEOS routines.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@4882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b6359772b12d5d931b286e1112670d664fb5a46a 1 parent 1a657ec
@jbronn jbronn authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 django/contrib/gis/geos/__init__.py
View
19 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()
+
Please sign in to comment.
Something went wrong with that request. Please try again.