@@ -6,8 +6,8 @@ function addSource(name, source) {
6
6
} ) ;
7
7
}
8
8
9
- const isCow = [ '==' , [ 'get' , 'type ' ] , 'Venue ' ] ;
10
- const isPig = [ '==' , [ 'get' , 'type ' ] , 'Attraction ' ] ;
9
+ const isCow = [ '==' , [ 'get' , 'species ' ] , 'dairy cattle ' ] ;
10
+ const isPig = [ '==' , [ 'get' , 'species ' ] , 'pig ' ] ;
11
11
12
12
function addLayer ( source ) {
13
13
if ( map . getLayer ( 'points' ) ) {
@@ -18,7 +18,7 @@ function addLayer(source) {
18
18
type : 'symbol' ,
19
19
source,
20
20
layout : {
21
- 'icon-image' : [ 'case' , isCow , 'cow' , isPig , 'pig' , 'cow ' ] ,
21
+ 'icon-image' : [ 'case' , isCow , 'cow' , isPig , 'pig' , 'none ' ] ,
22
22
'icon-size' : 0.15 ,
23
23
'icon-overlap' : 'always'
24
24
} ,
@@ -29,7 +29,8 @@ function addLayer(source) {
29
29
let popups = null ;
30
30
const icons = {
31
31
cow : '/img/cow.svg' ,
32
- pig : '/img/pig.svg'
32
+ pig : '/img/pig.svg' ,
33
+ none : '/img/none.svg'
33
34
} ;
34
35
35
36
function initMap ( ) {
@@ -59,11 +60,13 @@ function initMap() {
59
60
if ( popups ) {
60
61
popups . remove ( ) ;
61
62
}
62
- popups = new maplibregl . Popup ( )
63
- . setHTML ( `<div class="popup-info"> ${ content } </div>` )
64
- . setLngLat ( feature . geometry . coordinates ) ;
63
+ if ( feature . properties . species ) {
64
+ popups = new maplibregl . Popup ( )
65
+ . setHTML ( `<div class="popup-info"> ${ content } </div>` )
66
+ . setLngLat ( feature . geometry . coordinates ) ;
65
67
66
- popups . addTo ( map ) ;
68
+ popups . addTo ( map ) ;
69
+ }
67
70
} ) ;
68
71
69
72
map . on ( 'load' , function ( ) {
0 commit comments