From 4692ac1ec57d1938f9a24061fb46b72c3553f95d Mon Sep 17 00:00:00 2001 From: Guan Qing Date: Thu, 26 Jun 2014 12:54:17 +0800 Subject: [PATCH 1/2] Fixed id_func and clocl --- topojson/topology.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/topojson/topology.py b/topojson/topology.py index 652c5ae..db1756f 100644 --- a/topojson/topology.py +++ b/topojson/topology.py @@ -13,11 +13,11 @@ def property_transform (outprop, key, inprop): return True def topology (objects, stitchPoles=True,quantization=1e4,id_key='id',property_transform=property_transform,system = False,simplify=False): ln = Line(quantization) - id_func = lambda x:x[id_key] + id_func = lambda x:x.get(id_key) if simplify: objects = simplify_object(objects,simplify) [x0,x1,y0,y1]=bound(objects) - + oversize = x0 < -180 - E or x1 > 180 + E or y0 < -90 - E or y1 > 90 + E if not system: if oversize: @@ -51,7 +51,7 @@ def topology (objects, stitchPoles=True,quantization=1e4,id_key='id',property_tr if not quantization: quantization = x1 + 1 x0 = y0 = 0 - + class findEmax(Types): def __init__(self,obj): self.emax=0 @@ -68,7 +68,8 @@ def point(self,point): point[1] = int(y) finde=findEmax(objects) emax = finde.emax - clock(objects,system.ring_area) + clock = Clock(system.ring_area) + objects = clock.clock(objects) class find_coincidences(Types): def line(self,line): for point in line: From 198fa74931f8e4a493f8ac98996ba4b2fe7ee9b6 Mon Sep 17 00:00:00 2001 From: Guan Qing Date: Thu, 26 Jun 2014 15:38:31 +0800 Subject: [PATCH 2/2] Not return? --- topojson/topology.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/topojson/topology.py b/topojson/topology.py index db1756f..80fe518 100644 --- a/topojson/topology.py +++ b/topojson/topology.py @@ -69,7 +69,7 @@ def point(self,point): finde=findEmax(objects) emax = finde.emax clock = Clock(system.ring_area) - objects = clock.clock(objects) + clock.clock(objects) class find_coincidences(Types): def line(self,line): for point in line: