Ticket #10222: linemerge.patch
File linemerge.patch, 4.1 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/geos/base.py
551 551 "Returns a Geometry representing all the points in this Geometry and other." 552 552 return self._topology(geos_union(self.ptr, other.ptr)) 553 553 554 def line_merge(self): 555 """ 556 Returns a Geometry representing the line merge of a geometry collection 557 or multi-linestring geometry. 558 """ 559 return self._topology(geos_linemerge(self.ptr)) 560 554 561 #### Other Routines #### 555 562 @property 556 563 def area(self): -
django/contrib/gis/geos/prototypes/topology.py
28 28 geos_simplify = topology(lgeos.GEOSSimplify, c_double) 29 29 geos_symdifference = topology(lgeos.GEOSSymDifference, GEOM_PTR) 30 30 geos_union = topology(lgeos.GEOSUnion, GEOM_PTR) 31 geos_linemerge = topology(lgeos.GEOSLineMerge) 31 32 32 33 # GEOSRelate returns a string, not a geometry. 33 34 geos_relate = lgeos.GEOSRelate -
django/contrib/gis/geos/prototypes/__init__.py
30 30 from django.contrib.gis.geos.prototypes.topology import \ 31 31 geos_boundary, geos_buffer, geos_centroid, geos_convexhull, geos_difference, \ 32 32 geos_envelope, geos_intersection, geos_pointonsurface, geos_preservesimplify, \ 33 geos_simplify, geos_symdifference, geos_union, geos_relate 33 geos_simplify, geos_symdifference, geos_union, geos_relate, geos_linemerge -
django/contrib/gis/tests/test_geos.py
767 767 self.assertEqual(geom, tmpg) 768 768 if not no_srid: self.assertEqual(geom.srid, tmpg.srid) 769 769 770 def test26_line_merge(self): 771 "Testing line merge support" 772 pre_merge = fromstr(line_merge_geoms[0].wkt) 773 post_merge = fromstr(line_merge_geoms[1].wkt) 774 self.assertEqual(pre_merge.line_merge().wkt, post_merge.wkt) 775 770 776 def suite(): 771 777 s = unittest.TestSuite() 772 778 s.addTest(unittest.makeSuite(GEOSTest)) -
django/contrib/gis/tests/geometries.py
151 151 2.0, 8), 152 152 ) 153 153 154 line_merge_geoms = (TestGeom('MULTILINESTRING((1 1, 3 3), (3 3, 4 2))'), 155 TestGeom('LINESTRING (1.0000000000000000 1.0000000000000000, 3.0000000000000000 3.0000000000000000, 4.0000000000000000 2.0000000000000000)')) 156 154 157 json_geoms = (TestGeom('POINT(100 0)', json='{ "type": "Point", "coordinates": [ 100.000000, 0.000000 ] }'), 155 158 TestGeom('POLYGON((0 0, -10 0, -10 -10, 0 -10, 0 0))', json='{ "type": "Polygon", "coordinates": [ [ [ 0.000000, 0.000000 ], [ -10.000000, 0.000000 ], [ -10.000000, -10.000000 ], [ 0.000000, -10.000000 ], [ 0.000000, 0.000000 ] ] ] }'), 156 159 TestGeom('MULTIPOLYGON(((102 2, 103 2, 103 3, 102 3, 102 2)), ((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 1.0, 100.0 0.0), (100.2 0.2, 100.8 0.2, 100.8 0.8, 100.2 0.8, 100.2 0.2)))', json='{ "type": "MultiPolygon", "coordinates": [ [ [ [ 102.000000, 2.000000 ], [ 103.000000, 2.000000 ], [ 103.000000, 3.000000 ], [ 102.000000, 3.000000 ], [ 102.000000, 2.000000 ] ] ], [ [ [ 100.000000, 0.000000 ], [ 101.000000, 0.000000 ], [ 101.000000, 1.000000 ], [ 100.000000, 1.000000 ], [ 100.000000, 0.000000 ] ], [ [ 100.200000, 0.200000 ], [ 100.800000, 0.200000 ], [ 100.800000, 0.800000 ], [ 100.200000, 0.800000 ], [ 100.200000, 0.200000 ] ] ] ] }'),