Changeset 5832
- Timestamp:
- 08/08/07 22:07:02 (1 year ago)
- Files:
-
- django/branches/gis/django/contrib/gis/geos/base.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/geos/geometries.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/geos/libgeos.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/tests/test_geos.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/geos/base.py
r5805 r5832 13 13 import re 14 14 from warnings import warn 15 from django.contrib.gis.geos.libgeos import lgeos, GEOSPointer, HAS_NUMPY, ISQLQuote , GEOM_FUNC_PREFIX15 from django.contrib.gis.geos.libgeos import lgeos, GEOSPointer, HAS_NUMPY, ISQLQuote 16 16 from django.contrib.gis.geos.error import GEOSException, GEOSGeometryIndexError 17 17 from django.contrib.gis.geos.coordseq import GEOSCoordSeq, create_cs … … 205 205 def getquoted(self): 206 206 "Returns a properly quoted string for use in PostgresSQL/PostGIS." 207 # GeomFromText() is ST_GeomFromText() in PostGIS >= 1.2.2 to correspond 208 # to SQL/MM ISO standard. 209 return "%sGeomFromText('%s', %s)" % (GEOM_FUNC_PREFIX, self.wkt, self.srid or -1) 207 # Using ST_GeomFromText(), corresponds to SQL/MM ISO standard. 208 return "ST_GeomFromText('%s', %s)" % (self.wkt, self.srid or -1) 210 209 211 210 #### Coordinate Sequence Routines #### django/branches/gis/django/contrib/gis/geos/geometries.py
r5805 r5832 168 168 169 169 # Creating the coordinate sequence 170 cs = GEOSCoordSeq(GEOSPointer(0, create_cs(c_uint(ncoords), c_uint(ndim))) )170 cs = GEOSCoordSeq(GEOSPointer(0, create_cs(c_uint(ncoords), c_uint(ndim))), z=bool(ndim==3)) 171 171 172 172 # Setting each point in the coordinate sequence django/branches/gis/django/contrib/gis/geos/libgeos.py
r5786 r5832 22 22 try: 23 23 from psycopg2.extensions import ISQLQuote 24 from django.contrib.gis.db.backend.postgis import GEOM_FUNC_PREFIX25 24 except (ImportError, EnvironmentError): 26 25 ISQLQuote = None 27 GEOM_FUNC_PREFIX = None28 26 29 27 # Setting the appropriate name for the GEOS-C library, depending on which django/branches/gis/django/contrib/gis/tests/test_geos.py
r5805 r5832 595 595 del mpoly 596 596 597 598 def test17_threed(self): 599 "Testing three-dimensional geometries." 600 601 # Testing a 3D Point 602 pnt = Point(2, 3, 8) 603 self.assertEqual((2.,3.,8.), pnt.coords) 604 self.assertRaises(TypeError, pnt.set_coords, (1.,2.)) 605 pnt.coords = (1.,2.,3.) 606 self.assertEqual((1.,2.,3.), pnt.coords) 607 608 # Testing a 3D LineString 609 ls = LineString((2., 3., 8.), (50., 250., -117.)) 610 self.assertEqual(((2.,3.,8.), (50.,250.,-117.)), ls.tuple) 611 self.assertRaises(TypeError, ls.__setitem__, 0, (1.,2.)) 612 ls[0] = (1.,2.,3.) 613 self.assertEqual((1.,2.,3.), ls[0]) 614 615 597 616 def suite(): 598 617 s = unittest.TestSuite()
