function loadProjProfMap(mapHold, pID, type, globFlag, bbFlag, bbCoords){
var yearArr = ["2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025"];
var type = type;
var monthNumArr = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
var monthLabArr = ["", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
var returnDates = [];
var geojsonPointOptions_Added = {
radius: 6,
fillColor: "#688AA3",
color: "#888",
weight: 1,
opacity: 0.6,
fillOpacity: 0.5
};
var geojsonPointOptions_Selected = {
radius: 6,
fillColor: "#ED592E",
color: "#888",
weight: 1,
opacity: 0.6,
fillOpacity: 0.8
}
var geojsonPolygonOptions = {
fillColor: "#ED592E",
color: "#ED592E",
weight: 1,
opacity: 0.6,
fillOpacity: 0.5,
};
var geojsonLineOptions = {
color: "#000",
weight: 2,
opacity: 0.6
};
L.Map = L.Map.extend({
openPopup: function(popup) {
this._popup = popup;
pol = this._popup;
return this.addLayer(popup).fire('popupopen', {
popup: this._popup
});
}
});
// console.log(mapHold)
map = L.map(mapHold, {
center: [63, -126],
zoom:3,
zoomControl: false,
attributionControl: false,
scrollWheelZoom: false,
zoomAnimation: false
})
// map.invalidateSize(true);
map.scrollWheelZoom.disable();
L.Control.boxzoom({
position: "bottomleft"
}).addTo(map);
if(type == 'project'){
$('
', {class: 'zoomOutButton', title:'Zoom Out', id:'zoomOutButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'zoomInButton', title:'Zoom In', id:'zoomInButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'HomeButton', title:'Reset View', id:'homeButton_'+pID}).appendTo('#'+mapHold);
}else if(type == 'product'){
$('', {class: 'zoomOutButton', title:'Zoom Out', id:'zoomOutButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'zoomInButton', title:'Zoom In', id:'zoomInButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'HomeButton', title:'Reset View', id:'homeButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'boundButton', title:'Show Bounding Box', id:'boundButton_'+pID}).appendTo('#'+mapHold);
$('', {class: 'featButton', title:'Show Data Collection Locations', id:'featButton_'+pID}).appendTo('#'+mapHold);
}
map.options.minZoom = 3;
var basemapLayer = L.esri.basemapLayer('Streets').addTo(map);
bbLayer = layerFunctions.poly_create_layer(geojsonPolygonOptions)
map.addLayer(bbLayer);
if(bbFlag == 1){
rect = L.rectangle(bbCoords);
bbDat = layerFunctions.create_geoJSON('Polygon', rect._latlngs, "Spatial Extent");
bbLayer.addData(bbDat);
$('#boundButton_'+pID).addClass('buttSel');
// $("#boundButton").addClass('buttEnab');
}else{
$('#boundButton_'+pID).addClass('buttDis');
}
var markers = L.markerClusterGroup({
polygonOptions: {
color: '#688AA3',
weight: 2,
opacity: 1,
fillOpacity: 0.5
}
});
// map.invalidateSize();
profIDArr = pID.split('_');
profID = profIDArr[0];
$.ajax({
url: "https://cce.nasa.gov/cgi-bin/profile_slides/profile_maps.pl?id="+profID+"&itemtype="+type+"&action=1",
dataType: 'json',
success: function(data){
var points = point_create_layer();
if(data.features.length > 0){
if(type == 'project'){
map.addLayer(markers);
$('#datTitle_'+pID).html("Select a feature on the map to display information about that location.");
}else{
if(bbFlag == 0){
$('#featButton_'+pID).trigger('click')
}else{
$('#datTitle_'+pID).html("Click on to view data collection event locations.");
}
}
$('#featButton_'+pID).addClass('buttEnab')
for(var i=0;i', {class: 'outerContainerStyle', id:'outerContainer'+x}).appendTo('#dcEventList_'+pID);
$('', {class: 'callHoldStyle', id:'calHold'+x}).appendTo('#outerContainer'+x);
$('', {class: 'measContHoldStyle', id:'measContHold'+x}).appendTo('#outerContainer'+x);
$('', {class: 'monthHeaderHoldStyle', id:'monthHeaderHold'+x}).appendTo('#calHold'+x);
for(var i=0; i', {class: 'monthLabelHoldStyle', id:'monthLabelHolder'+x+'_'+i}).appendTo('#monthHeaderHold'+x);
$('#monthLabelHolder'+x+'_'+ 0).html(x+1);
$('#monthLabelHolder'+x+'_'+ 0).addClass('dcLabelHoldStyle')
$('#monthLabelHolder'+x+'_'+i).html(monthLabArr[i]);
}
for(var a=0; a', {class: 'yearHoldStyle', id:'yearHold'+x+'_'+a}).appendTo('#calHold'+x);
$('', {class: 'yearLabelHoldStyle', id:'yearLabelHold'+x+'_'+a}).appendTo('#yearHold'+x+'_'+a);
$('#yearLabelHold'+x+'_'+a).html(yearArr[a]);
for(var b=0; b<12; b++){
$('', {class: 'monthIndHoldStyle', id:'monthIndHolder'+x+'_'+yearArr[a]+"_"+monthNumArr[b]}).appendTo('#yearHold'+x+'_'+a);
}
}
for(var c=0; c', {class: 'measListLabelStyle', id:'measLabel'}).appendTo('#measContHold'+x);
$('#measLabel').html('Measurement Types')
$('', {class: 'measListStyle', id:'measList'+x}).appendTo('#measContHold'+x);
for(var i=0;i', {class: 'contentIndentStyle', id:'measListItem'+x+'_'+i}).appendTo('#measList'+x);
$('#measListItem'+x+'_'+i).html(data.meas_suites[x].meas_types[i])
}
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert("profileData Save: "+ errorThrown);
}
});
}
function clickFeat(e){
map.eachLayer(function(layer){
if(layer.options.fillColor == "#ED592E"){
layer.setStyle({fillColor:"#688AA3"})
}
});
$('#datTitle_'+pID).html(e.target.feature.properties.name);
e.target.closePopup();
if($('#dcEventList_'+pID)[0].firstChild != null){
dcCont = $('#dcEventList_'+pID)[0].firstChild.id;
// $('#dcEventList_'+pID).css('height', '133px');
// console.log('dcEventList_'+uid)
$('#'+dcCont).remove();
}
$('#dcEventList_'+pID).empty();
featReturnObj = {};
returnDates = [];
featReturnObj["FeatureGroup_IDS"] = e.target.feature.properties.FeatureGroup_IDS;
// pointLayer.setStyle(geojsonPointOptions_Added);
e.target.setStyle(geojsonPointOptions_Selected);
grabCalDat(featReturnObj);
}
function point_create_layer(){
var pointLayer = new L.geoJson(null, {
onEachFeature:onEachFeature,
pointToLayer: function (feature, latlng) {
var marker = new L.CircleMarker(latlng, geojsonPointOptions_Added);
//markerMap[feature.properties.name] = marker;
return marker
},
style: style
})
return pointLayer;
}
function style(feature){
var geoType = feature.geometry.type;
switch(geoType){
case"Point":
return geojsonPointOptions_Added;
case"marker":
return geojsonPointOptions;
case"Polygon":
return geojsonPolygonOptions;
case"MultiPolygon":
return geojsonPolygonOptions;
case"rectangle":
return geojsonPolygonOptions;
case"LineString":
return geojsonLineOptions;
case"polyline":
return geojsonLineOptions;
}
}
$('#zoomInButton_'+pID).hover(function(){
$('#zoomInButton_'+pID).css('background-position', '-35px 0');
},function(){
$('#zoomInButton_'+pID).css('background-position', '0 0');
});
$('#zoomInButton_'+pID).on('click', function(){
var zoomLevel = map.getZoom();
map.setZoom(zoomLevel + 1)
});
$('#zoomOutButton_'+pID).hover(function(){
$('#zoomOutButton_'+pID).css('background-position', '-35px 0');
},function(){
$('#zoomOutButton_'+pID).css('background-position', '0 0');
});
$('#zoomOutButton_'+pID).on('click', function(){
var zoomLevel = map.getZoom();
map.setZoom(zoomLevel - 1)
});
$('#homeButton_'+pID).hover(function(){
$('#homeButton_'+pID).css('background-position', '-35px 0');
},function(){
$('#homeButton_'+pID).css('background-position', '0 0');
});
$('#homeButton_'+pID).on('click', function(){
$("#dcEventList").empty();
$('#datTitle_'+pID).html("Select a feature on the map to display information about that location.")
map.setView([63, -126], 3);
});
$(".leaflet-control-boxzoom ").hover(function(){
$('.leaflet-control-boxzoom ').css('background-position', '-35px 0');
},function(){
$('.leaflet-control-boxzoom ').css('background-position', '0 0');
});
$('#boundButton_'+pID).on('click', boundHandler);
$('#featButton_'+pID).on('click', featHandler);
function boundHandler(){
console.log('b')
$('#boundButton_'+pID).off('click')
$('#boundButton_'+pID).addClass('buttSel');
$('#boundButton_'+pID).removeClass('buttEnab');
$('#featButton_'+pID).removeClass('buttSel');
bbLayer.clearLayers();
bbLayer.addData(bbDat);
map.removeLayer(markers);
// $('#datTitle_'+pID).html("");
$('#datTitle_'+pID).html("Click on to view data collection event locations.");
$('#featButton_'+pID).on('click', featHandler);
}
function featHandler(){
console.log('f')
$('#featButton_'+pID).off('click');
$('#featButton_'+pID).addClass('buttSel');
$('#featButton_'+pID).removeClass('buttEnab');
$('#boundButton_'+pID).removeClass('buttSel');
bbLayer.clearLayers();
map.addLayer(markers);
$('#datTitle_'+pID).html("Select a feature on the map to display information about that location.");
if(bbFlag == 0){
$('#boundButton_'+pID).off('click');
}else{
$('#boundButton_'+pID).on('click', boundHandler);
}
}
}
// });