public/map.js
// and creates a pin on the map for each member
and creates a pin on the map for each member
and creates a pin on the map for each member
function loadMembersOnMap(ne,sw){
    fbi.where("copied_account", "==", false).where("current_address.lat" , "<", ne.lat).where("current_address.lat", ">", sw.lat)
    .get().then( function(result){
        result.forEach( function(doc){
			if(!members.includes(doc.id) && doc.data().current_address.lat){
				memberData = doc.data();
				var memLoc = {lat:memberData.current_address.lat, lng:memberData.current_address.lng};
				var name = memberData.first_name+" "+memberData.last_name;
				if( memLoc.lng < ne.lng && memLoc.lng > sw.lng  ){
					members.push(doc.id);
					let currentTown = (memberData.current_address) ? (memberData.current_address.locality || "") : "";
					let homeTown = (memberData.hometown_address) ? (memberData.hometown_address.locality || "") : "";
					var contentString = `<span class="fas fa-gnl-map fa-portrait"></span><b>${memberData.first_name} ${memberData.last_name}</b><br/>
<span class="fas fa-gnl-map fa-map-marker-alt"></span>${currentTown}<br/>					
<span class="fas fa-gnl-map fa-briefcase"></span>${memberData.industry}<br/>
<span class="fas fa-gnl-map fa-anchor"></span>${homeTown}`;
					var marker = new google.maps.Marker({
						position : memLoc,
						title: name,
						text: contentString
					})
					google.maps.event.addListener(marker, 'spider_click', function(e) {  
						infowindow.setContent(marker.text);
						infowindow.open(_map, marker);
					});
					oms.addMarker(marker);  
				}
			}
		}		)
    })
}
function loadMembersOnMap ( ne , sw ) { fbi . where ( "copied_account" , "==" , false ) . where ( "current_address.lat" , "<" , ne . lat ) . where ( "current_address.lat" , ">" , sw . lat ) . get ( ) . then ( function ( result ) { result . forEach ( function ( doc ) { if ( ! members . includes ( doc . id ) && doc . data ( ) . current_address . lat ) { memberData = doc . data ( ) ; var memLoc = { lat : memberData . current_address . lat , lng : memberData . current_address . lng } ; var name = memberData . first_name + " " + memberData . last_name ; if ( memLoc . lng < ne . lng && memLoc . lng > sw . lng ) { members . push ( doc . id ) ; let currentTown = ( memberData . current_address ) ? ( memberData . current_address . locality || "" ) : "" ; let homeTown = ( memberData . hometown_address ) ? ( memberData . hometown_address . locality || "" ) : "" ; var contentString = ` ${ memberData . first_name } ${ memberData . last_name } ${ currentTown } ${ memberData . industry } ${ homeTown } ` ; var marker = new google . maps . Marker ( { position : memLoc , title : name , text : contentString } ) google . maps . event . addListener ( marker , 'spider_click' , function ( e ) { infowindow . setContent ( marker . text ) ; infowindow . open ( _map , marker ) ; } ) ; oms . addMarker ( marker ) ; } } } ) } ) }
and creates a pin on the map for each member
and creates a pin on the map for each member
// Oddly enough, you can't filter over different fields... so we take whatever is // between the latitude lines and filter out the longitude locally // 'spider_click', not plain 'click' // adds the marker to the spiderfier _and_ the map