diff --git a/exercisemodel/__init__.py b/exercisemodel/__init__.py index e224c24df781e749470b1235b54f549b372d4eea..8d502460af74b42f8bf6612ed3c8aee0650164f4 100644 --- a/exercisemodel/__init__.py +++ b/exercisemodel/__init__.py @@ -23,7 +23,7 @@ def storetree(): sections = [] for line in lines: - if len(section) == 10: + if len(section) == 1000: sections.append(LineString(section)) section = [] if '-999999' in line: diff --git a/exercisemodel/model.py b/exercisemodel/model.py index a6c73a23e80e2a2c508d9fb220ae2f8d1f74e851..54c19d76c461d5c3fb1dfd41126383f8a4d18ebe 100644 --- a/exercisemodel/model.py +++ b/exercisemodel/model.py @@ -285,10 +285,11 @@ class Model(object): deactivepoints = [] linestring = geometry.shape(exercisefeature['geometry']) latlngpoints = [[latlng[1], latlng[0]] for latlng in linestring.coords] + print('before matches') matches = strtree.query(LineString(latlngpoints)) - # print('matches: '+str(matches)) + print('matches: '+str(matches)) for i, coord in enumerate(linestring.coords): - # start = time.time() + start = time.time() if (len(mp.geoms) > 0): points = self.centerPoints(coord, mp.centroid, mp.geoms) displacedpoints = self.displacePoints(pDist, points) @@ -296,8 +297,8 @@ class Model(object): deactivepoints += onlandpoints # print('active: '+str(len(activepoints))) # print('onland: '+str(len(onlandpoints))) - # end = time.time() - # print('onland: '+str(end-start)) + end = time.time() + print('onland: '+str(end-start)) mp = geometry.MultiPoint(activepoints+deactivepoints) level = [0] * len(mp.geoms) category = [2] * len(mp.geoms) diff --git a/exercisemodel/resources/strtree.pickle b/exercisemodel/resources/strtree.pickle index f7339b03f6e191366abd63fdbeee421c7d14b10e..dcf9a1ad6761dd890f6446d9e44c499d483140e0 100644 Binary files a/exercisemodel/resources/strtree.pickle and b/exercisemodel/resources/strtree.pickle differ