Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docrecJSON-utilities
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marc-Philipp Knechtle
docrecJSON-utilities
Commits
24b99933
Commit
24b99933
authored
2 years ago
by
Marc-Philipp Knechtle
Browse files
Options
Downloads
Patches
Plain Diff
add get_intersecting_cells
parent
abcc4248
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docrecutils/cells.py
+19
-0
19 additions, 0 deletions
docrecutils/cells.py
with
19 additions
and
0 deletions
docrecutils/cells.py
0 → 100644
+
19
−
0
View file @
24b99933
from
docrecjson.elements
import
Cell
from
typing
import
List
from
shapely
import
geometry
as
shapely
def
get_intersecting_cells
(
cell
:
Cell
,
cells
:
List
[
Cell
])
->
List
[
Cell
]:
"""
:param: cell: cell which the intersection is performed on
:param: cells: list of cells to check for the intersection
:return: every cell which intersects the original cell
"""
p_1_area
:
shapely
.
Polygon
=
shapely
.
Polygon
(
cell
.
bounding_box
.
polygon
)
intersecting_cells
:
list
=
[]
for
compare_cell
in
cells
:
p_2_area
:
shapely
.
Polygon
=
shapely
.
Polygon
(
compare_cell
.
bounding_box
.
polygon
)
if
p_1_area
.
intersects
(
p_2_area
):
intersecting_cells
.
append
(
compare_cell
)
return
intersecting_cells
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment