mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +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:
parent
1a657ecf52
commit
b6359772b1
19
django/contrib/gis/geos/__init__.py
Normal file
19
django/contrib/gis/geos/__init__.py
Normal 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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user