Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DENUE tiles
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
DENUE tiles
Commits
e89db22a
Commit
e89db22a
authored
Jan 05, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix when nothing is selected and when only poly and circle intersection exists
parent
ab52bb05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
functions.js
public/js/functions.js
+18
-4
No files found.
public/js/functions.js
View file @
e89db22a
...
@@ -238,19 +238,22 @@ map.on("click", "muni_polygon", e => {
...
@@ -238,19 +238,22 @@ map.on("click", "muni_polygon", e => {
let
muniInteresects
=
selectedMunis
.
filter
(
el
=>
turf
.
intersect
(
el
.
geom
,
circleGeom
));
let
muniInteresects
=
selectedMunis
.
filter
(
el
=>
turf
.
intersect
(
el
.
geom
,
circleGeom
));
let
intersectedIDs
=
muniInteresects
.
map
(
a
=>
a
.
id
);
let
intersectedIDs
=
muniInteresects
.
map
(
a
=>
a
.
id
);
if
(
intersectedIDs
.
length
>
0
)
{
if
(
intersectedIDs
.
length
>
0
)
{
// if at least one polygons intersects circle geom
// ids not intersecting circle
let
selectedIDs2
=
selectedIDs
.
filter
(
id
=>
intersectedIDs
.
indexOf
(
id
)
==
-
1
);
let
selectedIDs2
=
selectedIDs
.
filter
(
id
=>
intersectedIDs
.
indexOf
(
id
)
==
-
1
);
// depending on selected polygons, use them and geom inside circle
map
.
setFilter
(
"denue"
,
map
.
setFilter
(
"denue"
,
[
"any"
,[
[
"any"
,[
"match"
,
"match"
,
[
"get"
,
"municipio_cvegeo"
],
[
"get"
,
"municipio_cvegeo"
],
selectedIDs2
,
// if there are polygons outside of circle intersection or use fake id to only use circle geom
selectedIDs2
.
length
>
0
?
selectedIDs2
:
[
"sin-clave"
],
true
,
true
,
false
false
],
[
'within'
,
circleGeom
]
],
[
'within'
,
circleGeom
]
]
]
);
);
}
else
{
}
else
if
(
selectedIDs
.
length
>
0
)
{
// if no circle intersection but only selected polygons
map
.
setFilter
(
"denue"
,
map
.
setFilter
(
"denue"
,
[
"all"
,[
[
"all"
,[
"match"
,
"match"
,
...
@@ -261,7 +264,18 @@ map.on("click", "muni_polygon", e => {
...
@@ -261,7 +264,18 @@ map.on("click", "muni_polygon", e => {
]
]
]
]
);
);
}
//TODO: handle case when nothing is selected
}
else
if
(
selectedIDs
.
length
==
0
)
{
// if no selected polygons use fake id
map
.
setFilter
(
"denue"
,
[
"all"
,[
"match"
,
[
"get"
,
"municipio_cvegeo"
],
[
"sin-clave"
],
true
,
false
]
]
);
}
}
}
});
});
...
...
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