Commit 2b0d555f authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

1000 section length on tree

parent 8aadeb67
...@@ -23,7 +23,7 @@ def storetree(): ...@@ -23,7 +23,7 @@ def storetree():
sections = [] sections = []
for line in lines: for line in lines:
if len(section) == 10: if len(section) == 1000:
sections.append(LineString(section)) sections.append(LineString(section))
section = [] section = []
if '-999999' in line: if '-999999' in line:
......
...@@ -285,10 +285,11 @@ class Model(object): ...@@ -285,10 +285,11 @@ class Model(object):
deactivepoints = [] deactivepoints = []
linestring = geometry.shape(exercisefeature['geometry']) linestring = geometry.shape(exercisefeature['geometry'])
latlngpoints = [[latlng[1], latlng[0]] for latlng in linestring.coords] latlngpoints = [[latlng[1], latlng[0]] for latlng in linestring.coords]
print('before matches')
matches = strtree.query(LineString(latlngpoints)) matches = strtree.query(LineString(latlngpoints))
# print('matches: '+str(matches)) print('matches: '+str(matches))
for i, coord in enumerate(linestring.coords): for i, coord in enumerate(linestring.coords):
# start = time.time() start = time.time()
if (len(mp.geoms) > 0): if (len(mp.geoms) > 0):
points = self.centerPoints(coord, mp.centroid, mp.geoms) points = self.centerPoints(coord, mp.centroid, mp.geoms)
displacedpoints = self.displacePoints(pDist, points) displacedpoints = self.displacePoints(pDist, points)
...@@ -296,8 +297,8 @@ class Model(object): ...@@ -296,8 +297,8 @@ class Model(object):
deactivepoints += onlandpoints deactivepoints += onlandpoints
# print('active: '+str(len(activepoints))) # print('active: '+str(len(activepoints)))
# print('onland: '+str(len(onlandpoints))) # print('onland: '+str(len(onlandpoints)))
# end = time.time() end = time.time()
# print('onland: '+str(end-start)) print('onland: '+str(end-start))
mp = geometry.MultiPoint(activepoints+deactivepoints) mp = geometry.MultiPoint(activepoints+deactivepoints)
level = [0] * len(mp.geoms) level = [0] * len(mp.geoms)
category = [2] * len(mp.geoms) category = [2] * len(mp.geoms)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment