Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
stw
wt
exercisemodel
Commits
558bcf75
Commit
558bcf75
authored
Dec 14, 2017
by
Tomas Pettersson
🏸
Browse files
temporary removed onland and tree
parent
d04cf52a
Changes
1
Hide whitespace changes
Inline
Side-by-side
exercisemodel/model.py
View file @
558bcf75
...
...
@@ -285,21 +285,22 @@ 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('before matches')
#
matches = strtree.query(LineString(latlngpoints))
#
print('matches: '+str(matches))
for
i
,
coord
in
enumerate
(
linestring
.
coords
):
start
=
time
.
time
()
if
(
len
(
mp
.
geoms
)
>
0
):
points
=
self
.
centerPoints
(
coord
,
mp
.
centroid
,
mp
.
geoms
)
displacedpoints
=
self
.
displacePoints
(
pDist
,
points
)
activepoints
,
onlandpoints
=
self
.
onlandPoints
(
mp
.
geoms
,
displacedpoints
,
matches
)
deactivepoints
+=
onlandpoints
#
start = time.time()
#
if (len(mp.geoms) > 0):
points
=
self
.
centerPoints
(
coord
,
mp
.
centroid
,
mp
.
geoms
)
displacedpoints
=
self
.
displacePoints
(
pDist
,
points
)
#
activepoints, onlandpoints = self.onlandPoints(mp.geoms, displacedpoints, matches)
#
deactivepoints += onlandpoints
# print('active: '+str(len(activepoints)))
# print('onland: '+str(len(onlandpoints)))
end
=
time
.
time
()
print
(
'onland: '
+
str
(
end
-
start
))
mp
=
geometry
.
MultiPoint
(
activepoints
+
deactivepoints
)
# end = time.time()
# print('onland: '+str(end-start))
# mp = geometry.MultiPoint(activepoints+deactivepoints)
mp
=
geometry
.
MultiPoint
(
displacedpoints
)
level
=
[
0
]
*
len
(
mp
.
geoms
)
category
=
[
2
]
*
len
(
mp
.
geoms
)
properties
=
self
.
createProperties
((
i
+
2
),
timearray
[
i
],
mp
.
centroid
,
level
,
category
)
...
...
@@ -307,7 +308,7 @@ class Model(object):
if
(
i
%
10
==
0
):
Cloudtrack
.
write
(
featurecollection
)
Particletrack
.
write
(
featurecollection
)
mp
=
geometry
.
MultiPoint
(
activepoints
)
#
mp = geometry.MultiPoint(activepoints)
print
(
'deactivepoints: '
+
str
(
len
(
deactivepoints
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment