1
0
mirror of https://github.com/django/django.git synced 2025-07-04 09:49:12 +00:00

gis: module for interfacing with GEOS routines.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@4882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn 2007-03-31 21:14:22 +00:00
parent 1a657ecf52
commit b6359772b1

View File

@ -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()