GRN MapApp

'; cdiv.innerHTML = d; //cdiv.innerHTML = dataresponse.getElementById("langByCntryTbl").innerHTML; //cdiv.innerHTML = ''; } function fmtLangResourcesResults(idResults,lncoords){ let lrmsg=''; let langiso=''; let materialtitle=''; let programgroup=''; let org=''; let url=''; let langname=''; let mediatype=''; let langnum=''; if (idResults.features[0].properties['ISO Language Code']){ langiso = idResults.features[0].properties['ISO Language Code']; } if (idResults.features[0].properties['Language Name']){ langname = idResults.features[0].properties['Language Name']; } //alert('fmtLangResourcesResults'); //lrmsg += '
Resource Information for '+langname+'
'; for (var i = 0; idResults.features.length > i; i++) { /*mrcoords = ''; if (idResults.features[i].geometry){ mrcoords = JSON.stringify(idResults.features[i].geometry.coordinates); } */ if ( lncoords[0] == idResults.features[i].geometry.coordinates[0] && lncoords[1] == idResults.features[i].geometry.coordinates[1]) { if (idResults.features[i].properties['Material Title']){ materialtitle = idResults.features[i].properties['Material Title']; if (materialtitle.toUpperCase() == 'NULL' || materialtitle.toUpperCase() == 'UNDEFINED') materialtitle = ''; } if (idResults.features[i].properties['Program Group']){ programgroup = idResults.features[i].properties['Program Group']; } if (idResults.features[i].properties['Organization']){ org = idResults.features[i].properties['Organization']; if (org.toUpperCase() == 'NULL' || org.toUpperCase() == 'UNDEFINED') org = ''; } if (idResults.features[i].properties['Website URL']){ url = idResults.features[i].properties['Website URL']; if (url.toUpperCase() == 'NULL' || url.toUpperCase() == 'UNDEFINED') url = ''; } if (idResults.features[i].properties['Media Type']){ mediatype = idResults.features[i].properties['Media Type']; if (mediatype.toUpperCase() == 'NULL' || mediatype.toUpperCase() == 'UNDEFINED') mediatype = ''; } if (idResults.features[i].properties['Language Number']){ langnum = idResults.features[i].properties['Language Number']; if (langnum.toUpperCase() == 'NULL' || langnum.toUpperCase() == 'UNDEFINED') langnum = ''; } let fieldName = []; let fieldVal = []; //fieldName.push('ISO Language Code');fieldVal.push(langiso); fieldName.push('Resource');fieldVal.push(materialtitle); fieldName.push('Provider');fieldVal.push(org); //fieldName.push('Program Group');fieldVal.push(programgroup); //fieldName.push('Website');fieldVal.push(url); //fieldName.push('Language Name');fieldVal.push(langname); //if (mediatype.toUpperCase() !== ''){ fieldName.push('Media Type');fieldVal.push(mediatype); //} //fieldName.push('Language Number');fieldVal.push(langnum); if (url !== '' || org !== '') { lrmsg+=''; for (key in fieldName) { val = fieldVal[key]; //console.log('fieldName: '+fieldName[key]+ ' val: '+val); if (fieldName[key] == 'Resource') { if (url.startsWith('https://') || url.startsWith('http://')) { val = ''+materialtitle+''; } } if (val !== '') { lrmsg+=''; } } lrmsg+='
'+fieldName[key].replace(/_/g,' ')+''+val+'
'; lrmsg+='
'; } else { lrmsg += '

Limited infomation found in resource record.



' } } } return lrmsg; } function fmtLangResults(idResults,c,fCt){ let msg=''; let country=''; let countryCode=''; let iso=''; //let lname=''; global let multiPt=''; let isoLangName=''; let otherKnownLang=''; let recordedLang='0'; let recordedNames=''; let unrecordedLang='0'; let unrecordedNames=''; let unverifiedLang='0'; let unverifiedNames=''; let extinct='No'; let totProgTime=''; let grnUrl=''; let ethnoUrl=''; let glottoUrl=''; let joshuaProj=''; let pctEvan=''; let g=[]; //let fCt=0; //if(!multi){clearMarker();multi=false;} if (fCt < 1){ msg = '

GRN Language Information

'; msg += ''; }else{ msg = '
IsoLanguage NameCountry
'; } for (var i = 0; idResults.features.length > i; i++) { var tr = ''; if (idResults.features[i].properties['Country']) { country = idResults.features[i].properties['Country']; } else if (idResults.features[i].properties['c1']) { country = idResults.features[i].properties['c1']; } if (idResults.features[i].properties['Country_code']){ countryCode = idResults.features[i].properties['Country_code']; }else if (idResults.features[i].properties['country_code']){ countryCode = idResults.features[i].properties['country_code']; } if (c == country || c == 'all'){ //console.log('Feature Properties: ' + JSON.stringify(idResults.features[i].properties)); //console.log('requested c: ' + c + ' found: ' + country); createMarker([idResults.features[i].geometry.coordinates],document.getElementById('markerColor').selectedOptions[0].value); let geom = JSON.stringify(idResults.features[i].geometry); let fcoords = JSON.stringify(idResults.features[i].geometry.coordinates); if (idResults.features[i].properties['Iso']){ iso = idResults.features[i].properties['Iso']; }else if (idResults.features[i].properties['iso']) { iso = idResults.features[i].properties['iso']; } if (idResults.features[i].properties['Language Name']){ lname = idResults.features[i].properties['Language Name']; }else if (idResults.features[i].properties['nam_label']){ lname = idResults.features[i].properties['nam_label']; } if(idResults.features[i].properties['Multipoint Feature']){ multiPt = idResults.features[i].properties['Multipoint Feature']; }else if (idResults.features[i].properties['multipoint']){ multiPt = idResults.features[i].properties['multipoint']; } if(idResults.features[i].properties['ISO Language Name']){ isoLangName = idResults.features[i].properties['ISO Language Name']; }else if (idResults.features[i].properties['iso_language_name']){ isoLangName=idResults.features[i].properties['iso_language_name']; } if(idResults.features[i].properties['Other Known Languages']){ otherKnownLang = idResults.features[i].properties['Other Known Languages']; }else if (idResults.features[i].properties['other_know_lang']){ otherKnownLang=idResults.features[i].properties['other_know_lang']; } //if(idResults.features[i].properties['Recorded Languages']){ // recordedLang=idResults.features[i].properties['Recorded Languages'].toString(); //}else if (idResults.features[i].properties['Recorded']){ recordedLang=idResults.features[i].properties['Recorded'].toString(); } else if (idResults.features[i].properties['recorded']){ recordedLang=idResults.features[i].properties['recorded'].toString(); } //if(idResults.features[i].properties['Recorded Names']){ // recordedNames=idResults.features[i].properties['Recorded Names']; //}else if (idResults.features[i].properties['recorded_names']){ // recordedNames=idResults.features[i].properties['recorded_names']; //} //if(idResults.features[i].properties['Unrecorded Languages']){ // unrecordedLang=idResults.features[i].properties['Unrecorded Languages'].toString(); //}else if (idResults.features[i].properties['Unrecorded']){ unrecordedLang=idResults.features[i].properties['Unrecorded'].toString(); } else if (idResults.features[i].properties['unrecorded']){ unrecordedLang=idResults.features[i].properties['unrecorded'].toString(); } //if(idResults.features[i].properties['Unrecorded Names']){ // unrecordedNames=idResults.features[i].properties['Unrecorded Names']; //}else if (idResults.features[i].properties['unrecorded_names']){ // unrecordedNames=idResults.features[i].properties['unrecorded_names'] //} //if(idResults.features[i].properties['Unverified Languages']){ // unverifiedLang=idResults.features[i].properties['Unverified Languages'].toString(); //}else if (idResults.features[i].properties['Unverified']){ unverifiedLang=idResults.features[i].properties['Unverified'].toString(); } else if (idResults.features[i].properties['unverified']){ unverifiedLang=idResults.features[i].properties['unverified'].toString(); } //if(idResults.features[i].properties['Unverified Names']){ // unverifiedNames=idResults.features[i].properties['Unverified Names']; //}else if (idResults.features[i].properties['unverified_names']){ // unverifiedNames=idResults.features[i].properties['unverified_names']; //} if(idResults.features[i].properties['Extinct']){ extinct=idResults.features[i].properties['Extinct']; }else if (idResults.features[i].properties['extinct']){ extinct=idResults.features[i].properties['extinct']; } if(idResults.features[i].properties['Total Program Minutes']){ totProgTime=idResults.features[i].properties['Total Program Minutes']; }else if (idResults.features[i].properties['program_length']){ totProgTime=idResults.features[i].properties['program_length']; } //if(idResults.features[i].properties['GRN Web']){ // grnUrl=idResults.features[i].properties['GRN Web']; //}else if (idResults.features[i].properties['link_to_web']){ // grnUrl=idResults.features[i].properties['link_to_web']; //} grnUrl = 'https://globalrecordings.net/language/'+iso; //if(idResults.features[i].properties['Ethnologue']){ // ethnoUrl=idResults.features[i].properties['Ethnologue']; //}else if (idResults.features[i].properties['ethnologuemap']){ // ethnoUrl=idResults.features[i].properties['ethnologuemap']; //} ethnoUrl = 'https://ethnologue.com/language/'+iso; //if(idResults.features[i].properties['Glottolog']){ // glottoUrl=idResults.features[i].properties['Glottolog']; //}else if (idResults.features[i].properties['glottolog']){ // glottoUrl=idResults.features[i].properties['glottolog']; //} glottoUrl = ''+iso; if(idResults.features[i].properties['Joshua Project Scale']){ joshuaProj=idResults.features[i].properties['Joshua Project Scale']; } //else if (idResults.features[i].properties['joshuaproject']){ //joshuaProj=idResults.features[i].properties['joshuaproject']; //} if(idResults.features[i].properties['Percent Evangelical']){ pctEvan=idResults.features[i].properties['Percent Evangelical'].toString(); }else if (idResults.features[i].properties['evangelical']){ pctEvan=idResults.features[i].properties['evangelical'].toString(); } //let oid = idResults.features[i].properties['objectid'].toString(); //let shp = idResults.features[i].properties['shape']; let prop = []; prop.push("'"+iso+"'"); prop.push("'"+encodeURI(lname)+"'"); prop.push("'"+encodeURI(country)+"'"); prop.push('"'+encodeURI(grnUrl)+'"'); prop.push('"'+encodeURI(ethnoUrl)+'"'); let fieldName = []; let fieldVal = []; fieldName.push('Muiltiple Points');fieldVal.push(multiPt); fieldName.push('GRN Language Name');fieldVal.push(lname); fieldName.push('ISO Language Name');fieldVal.push(isoLangName); fieldName.push('Other Known Languages');fieldVal.push(otherKnownLang); //fieldName.push('Country');fieldVal.push(country); fieldName.push('Total Recorded Varieties');fieldVal.push(recordedLang); //fieldName.push('Recorded Names');fieldVal.push(recordedNames); fieldName.push('Total Unrecorded Varieties');fieldVal.push(unrecordedLang); //fieldName.push('Unrecorded Names');fieldVal.push(unrecordedNames); fieldName.push('Total Unverified Varieties');fieldVal.push(unverifiedLang); //fieldName.push('Unverified Names');fieldVal.push(unverifiedNames); fieldName.push('Extinct');fieldVal.push(extinct); fieldName.push('Total Program Minutes');fieldVal.push(totProgTime); fieldName.push('GRN Web');fieldVal.push(grnUrl); //fieldName.push('Ethnologue');fieldVal.push(ethnoUrl); //fieldName.push('Glottolog');fieldVal.push(glottoUrl); fieldName.push('Joshua Project Scale');fieldVal.push(joshuaProj); //fieldName.push('Find A Bible');fieldVal.push('find.bible'); fieldName.push('Percent Evangelical');fieldVal.push(pctEvan); //fieldName.push('objectid');fieldVal.push(oid); //fieldName.push('shape');fieldVal.push(shp); msg+=tr+''; // msg+=''; msg+=''; if(c != 'all'){ g.push(JSON.parse(geom).coordinates); //break; } fCt+=1; } } //msg+=''; msg += '
' if (fCt + idResults.features.length == 1 || c !== 'all') { msg+='  '; }else{ msg+='  '; } msg+=''+iso+''+lname+''+country+'
'; if (idResults.features.length == 1 || c !== 'all') { msg +='
'; }else{ msg +='
Clear Markers
'; if(fCt == 1){ //toggleLang(0); - it's not there yet! findMultiByIsoAndCountry(iso,country); }; if(c != 'all' && multi != true){ cntry='all'; this.map.setView(getCentroid(g),zoomLevel); } return msg } function fmtMultiResults(idResults) { let msg=''; for (var i = 0; idResults.features.length > i; i++) { //console.log('mulipoint feature: '+JSON.stringify(idResults.features[i])); //let tr= ''; //console.log('Feature Geometry: ' + JSON.stringify(idResults.features[i].geometry)); geom = JSON.stringify(idResults.features[i].geometry); let oid = idResults.features[i].properties['OBJECTID']; let name = idResults.features[i].properties['Language Name']; var country = idResults.features[i].properties['Country']; var iso = idResults.features[i].properties['Iso']; let langCty = idResults.features[i].properties['Language-Country']; selectedFeatMulti(geom); // include langNames for multipoint let find = L.esri.find({url: srcMapServer}); find.layers(lnum_lang_names).text(iso).fields('Iso'); find.run(function (error, featureCollection, response) { if (error) {console.log('ERROR: '+JSON.stringify(error));return; } else if (featureCollection.features.length === 0){ console.log('Feature not found for: '+ iso); } else { //console.log('Found ' + featureCollection.features.length + ' feature(s) for iso: ' + iso); cntry = country; //msgP=''; pane.innerHTML += fmtLangResults(featureCollection,country,0); document.getElementById('grn').src = searchURL+'/language/'+iso; } }); //console.log('multiPtNamesLyr geom: ' + geom); } return msg; } function fmtLangPtsResults(idResults,fCt) { let iso=''; //let lname=''; global let autonym=''; let country_code=''; let glotto_id=''; let progress=''; let bibles_count=0; let films_count=0; let resources_count=0; let translations_count=0; let grnUrl=''; let ethnoUrl=''; let msg='Begin Lang Pts results'; let tr = ''; if (fCt < 1001){ msg = '

Language Resources

'; msg += ''; }else{ msg = '
IsoLanguage NameCountry
'; } //msg+=tr+''; msg+=iso+''; msg+=''; let fieldName = []; let fieldVal = []; fieldName.push('ISO Language Name');fieldVal.push(iso); fieldName.push('Name');fieldVal.push(lname); fieldName.push('Autonym');fieldVal.push(autonym); fieldName.push('Glotto ID');fieldVal.push(glotto_id); fieldName.push('Progress');fieldVal.push(progress); fieldName.push('Bible Count');fieldVal.push(bibles_count); fieldName.push('Film Count');fieldVal.push(films_count); fieldName.push('Resource Count');fieldVal.push(resources_count); //fieldName.push('Translations Count');fieldVal.push(translations_count); fieldName.push('GRN Web');fieldVal.push(grnUrl); msg+='
' for (var i = 0; idResults.features.length > i; i++) { //console.log('lang point feature: '+JSON.stringify(idResults.features[i])); //msg+=tr+'' createMarker([idResults.features[i].geometry.coordinates],document.getElementById('markerColor').selectedOptions[0].value); let geom = JSON.stringify(idResults.features[i].geometry); let fcoords = JSON.stringify(idResults.features[i].geometry.coordinates); if (idResults.features[i].properties['iso639_3']) { iso = idResults.features[i].properties['iso639_3']; } grnUrl = 'https://globalrecordings.net/language/'+iso if (idResults.features[i].properties['name']) { lname = idResults.features[i].properties['name']; } if (idResults.features[i].properties['autonym']){ autonym = idResults.features[i].properties['autonym']; } if (idResults.features[i].properties['country_code']){ country_code = idResults.features[i].properties['country_code']; } if (idResults.features[i].properties['glotto_id']){ glotto_id = idResults.features[i].properties['glotto_id']; } if (idResults.features[i].properties['progress']){ progress = idResults.features[i].properties['progress']; } if (idResults.features[i].properties['bibles_count']){ bibles_count = idResults.features[i].properties['bibles_count']; } if (idResults.features[i].properties['films_count']){ films_count = idResults.features[i].properties['films_count']; } if (idResults.features[i].properties['resources_count']){ resources_count = idResults.features[i].properties['resources_count']; } if (idResults.features[i].properties['translations_count']){ translations_count = idResults.features[i].properties['translations_count']; } msg+=tr+'' if (idResults.features.length == 1) { msg+='  '; }else{ msg+='  '; } let prop = []; prop.push("'"+iso+"'"); prop.push("'"+encodeURI(lname)+"'"); prop.push("'"+encodeURI(country_code)+"'"); prop.push('"'+encodeURI(grnUrl)+'"'); prop.push('"'+encodeURI(ethnoUrl)+'"'); //msg+=tr+'' //msg+=''+iso+''+lname+''+country_code+'
'+lname+''+country_code+'
'; if (fCt + idResults.features.length == 1) { msg +='
'; }else{ msg +='
'; for (key in fieldName) { val = fieldVal[key].toString(); console.log('fieldName: '+fieldName[key]+ ' val: '+val); if (!val || val.toUpperCase() == 'NULL') val = ""; if (val.startsWith('https://global')) { val = 'Global Recordings Network'; } else if (val.startsWith('https://')) { val = ''+fieldName[key].replace(/_/g,' ')+''; } msg+=''; } if(!document.getElementById('langResDiv'+fCt)) { msg +='
'+fieldName[key].replace(/_/g,' ')+''+val+'

⊞Resource Information

'; msg +='
'; msg+=''; msg+=''; msg+=''; } msg+=''; fCt+=1; } msg+='' return msg; } function fmtCntryResults(prop){ let msg = 'test'; cname = prop['Country']; let iso2 = prop['ISO 3166-1 Two letter country code'];ciso=iso2; let isoNum = prop['ISO Number']; let genc2 = prop['Geopolitical Entities, Names, and Codes 2 letter']; let genc3 = prop['Geopolitical Entities, Names, and Codes 3 letter']; let findBibleLink = 'find.bible'; let FIPScode = prop['FIPS Code']; let ow = prop['OW Abbreviation']; let id = prop['ID']; let fieldName = []; let fieldVal = []; fieldName.push('ID');fieldVal.push(id); fieldName.push('ISO 3166-1 Two letter country code');fieldVal.push(iso2); fieldName.push('ISO Number');fieldVal.push(isoNum); fieldName.push('Geopolitical Entities, Names, and Codes 2 letter');fieldVal.push(genc2); fieldName.push('Geopolitical Entities, Names, and Codes 3 letter');fieldVal.push(genc3); fieldName.push('FIPS Code');fieldVal.push(FIPScode); fieldName.push('OW Abbreviation');fieldVal.push(ow); fieldName.push('Find A Bible by Country');fieldVal.push(findBibleLink); msg = '

Country Information

'; msg+= ''; //msg+= ''; for (key in fieldName) { val = fieldVal[key]; if (!val || val.toUpperCase() == 'NULL') val = ""; msg+=''; } msg +=''; msg+=''; msg += '
Country Name: '+cname+'
'+cname+'
'+fieldName[key].replace(/_/g,' ')+''+val+'

⊞ Languages in '+cname+'

'; msg +='



  
Clear Country Highlight
' return msg } function onMapClick(e) { var msg = ''; //pane.innerHTML = ''; ct = 0; var coord = e.latlng; //https://gis.stackexchange.com/questions/210041/using-leaflet-js-is-it-possible-to-know-the-onclick-location-of-a-marker-ignor#:~:text=You%20always%20can%20retrieve%20the%20coordinates%20from%20the,%2B%20%22%20and%20longitude%3A%20%22%20%2B%20lng%29%3B%20%7D%29%3B //console.log(coord); if (drawEvent) { drawEvent = false; } else if (addMarker) { let coordArr = []; //console.log("You clicked the map at latitude: " + coord.lat + " and longitude: " + coord.lng); //console.log('You clicked the map at ' + JSON.stringify(coord)); coordArr.push(coord.lng,coord.lat); //console.log(coordArr); createMarker([coordArr],document.getElementById('markerColor').selectedOptions[0].value); addMarker = false; //set cursor } else { let featFound = 0; //pane.innerHTML = ''; clearMarker(); let clickTol = document.getElementById('clickTol').selectedOptions[0].value; if (window.innerWidth < 641) {clickTol = 20;} if (lyrs._layerControlInputs[lcnum_MultiPtLyr].checked) { multiPtNamesLyr .identify() .layers('visible:'+lnum_multipt) .tolerance(clickTol) .on(map) .at(e.latlng) .run(function (error, idResults) { if (error) {console.log('ERROR: '+JSON.stringify(error));return;} //console.log('Multipoint Feature count:' + idResults.features.length); //if (idResults.features.length > 0 && lyrs._layerControlInputs[9].checked) { if (idResults.features.length > 0){ //clearMarker(); pane.innerHTML = ''; multi=true; featFound = 1; //msg += ''; fmtMultiResults(idResults); sidebar.open('homePane'); } }); } if (lyrs._layerControlInputs[lcnum_LangResLyr].checked) { langDBSLyr .identify() .layers('visible:'+lnum_lang_pts) .tolerance(clickTol) .on(map) .at(e.latlng) .run(function (error, idResults) { if (error) {console.log('ERROR: '+JSON.stringify(error));return;} console.log('Language Points Feature count:' + idResults.features.length); console.log('Language Points Features:' + idResults.features); //if (idResults.features.length > 0 && lyrs._layerControlInputs[9].checked) { if (idResults.features.length > 0){ pane.innerHTML = ''; featFound=1; //clearMarker(); //msg += '
Language NameCountryIso
'; if (pane.innerHTML.indexOf("to display language") !== -1) { pane.innerHTML = ''; } pane.innerHTML += fmtLangPtsResults(idResults,0); sidebar.open('infoPane'); } }); } if (lyrs._layerControlInputs[lcnum_refugeeLyr].checked) { refugeeCampsLyr .identify() .layers('visible:0') .tolerance(clickTol) .on(map) .at(e.latlng) .run(function (error, idResults) { if (error) {console.log('ERROR: '+JSON.stringify(error));return;} //console.log('Refugee Camp Feature count:' + idResults.features.length); //console.log('Refugee Camp return: ' + JSON.stringify(idResults)); // make sure at least one feature was identified. if (idResults.features.length > 0) { featFound=1; pane.innerHTML = ''; //clearMarker(); //ct += idResults.features.length; //identifiedFeature = L.geoJSON(idResults.features[0]).addTo(map); msg += '

Refugee Camp(s)

'; msg += '
Language NameCountryIso
'; for (var i = 0; idResults.features.length > i; i++) { msg+='' //msg+=''+name+''; msg+=''; msg+=''; msg+=''; } msg+=''; msg += '
NameFacility TypeCountry
' //console.log('Feature Properties: ' + JSON.stringify(idResults.features[i].properties)); let geom = JSON.stringify(idResults.features[i].geometry); let oid = idResults.features[i].properties['OBJECTID']; let country = idResults.features[i].properties['cty']; let name = idResults.features[i].properties['name']; //let loc = idResults.features[i].properties['location']; //location is a keyword let campAddress = idResults.features[i].properties['camp_address']; let facility = idResults.features[i].properties['facility']; let lat = idResults.features[i].properties['latitude']; let lon = idResults.features[i].properties['longitude']; let locationsFrom = idResults.features[i].properties['locations_from'] let langSpoken = idResults.features[i].properties['languages_spoken']; //let contact = idResults.features[i].properties['contact']; //let email = idResults.features[i].properties['email']; //let notes = idResults.features[i].properties['notes']; //let pcode = idResults.features[i].properties['pcode']; //let gedit = idResults.features[i].properties['grn_edit']; let shp = idResults.features[i].properties['Shape']; let fieldName = [];let prop = []; //fieldName.push('ObjectID');prop.push(oid); fieldName.push('Country');prop.push(country); fieldName.push('Name');prop.push(name); //fieldName.push('Location');prop.push(loc); fieldName.push('Camp Address');prop.push(campAddress); fieldName.push('Facility');prop.push(facility); fieldName.push('Latitude');prop.push(lat); fieldName.push('Longitude');prop.push(lon); fieldName.push('Locations From');prop.push(locationsFrom); fieldName.push('Languages Spoken');prop.push(langSpoken); //fieldName.push('Shape');prop.push(shp); //console.log('prop:' + prop.toString()); msg+='
' msg+= ''+name+''+facility+''+country+'
'+country+'' + campAddress+'
'; msg+=''; msg+=''; msg+=''; for (key in fieldName) { tmpVal = prop[key]; if (!tmpVal || tmpVal.toUpperCase() == 'NULL') tmpVal = ""; msg+= ''; } msg+='
Details
'+fieldName[key]+''+tmpVal+'



  
Clear Markers
'; //if (ct > 0) { pane.innerHTML += msg; //} else { // pane.innerHTML = msg; //} ct += idResults.features.length; } sidebar.open('infoPane'); }); } if (lyrs._layerControlInputs[lcnum_recordedGrpLyr].checked || lyrs._layerControlInputs[lcnum_neediestGrpLyr].checked || lyrs._layerControlInputs[lcnum_extinctLyr].checked || lyrs._layerControlInputs[lcnum_unverifiedGrpLyr].checked) { langNamesLyr .identify() .layers('visible:' + lnum_lang_names) .tolerance(clickTol) .on(map) .at(e.latlng) .run(function (error, idResults) { if (error) {console.log('ERROR: '+JSON.stringify(error));return;} console.log('Language Names Feature count:' + idResults.features.length); //console.log('Language Names Results: ' + JSON.stringify(idResults)); // make sure at least one feature was identified. if (idResults.features.length > 0 ) { pane.innerHTML = ''; featFound = 1; //clearMarker(); ct += idResults.features.length; //msgP=''; if (pane.innerHTML.indexOf("to display language") !== -1) { pane.innerHTML = ''; } pane.innerHTML += fmtLangResults(idResults,'all',0); if(idResults.features.length == 1){ cntry = idResults.features[0].properties['Country']; document.getElementById('grn').src = searchURL+'/language/'+idResults.features[0].properties['Iso']; }else{ document.getElementById('grn').src = searchURL; } }else{ document.getElementById('grn').src = searchURL; } if (idResults.features.length == 1) { sidebar.open('homePane'); }else if (featFound == 1){ sidebar.open('infoPane'); } }); } //if (featFound == 0){ // pane.innerHTML = srchBlurb; //} /* Country not working countryLyr .identify() .layers('visible:7') .tolerance(clickTol) .on(map) .at(e.latlng) .run(function (error, idResults) { if (error) {console.log('ERROR: '+JSON.stringify(error));return;} let ct = idResults.features.length //console.log('Country Feature count:' + ct); var geom; ctyCent = [0,0]; });*/ } //else } //onMapClick(e) //map.on('mouseover', onMapHover); //map.on('mouseout', hoverOff); map.on('locationfound', onLocationFound); map.on('locationerror', onLocationError); //map.on('overlaychange', alert('overlaychange')); //map.on('baselayerchange', alert('baselayerchange')); //var onLayerChange = function (l){ return function ConLayerChange(e){ function onLayerChange(l){ //alert('vv'+ l); if (lyrs._layerControlInputs[lcnum_LangResLyr].checked) { map.removeLayer(langNamesLyr); }else { map.addLayer(langNamesLyr); map.removeLayer(langPtsGrpLyr); } if(lyrs._layerControlInputs[l].checked) { map.removeLayer(recordedGrpLyr); //map.removeLayer(unrecordedGrpLyr); map.removeLayer(unverifiedGrpLyr); map.removeLayer(neediestGrpLyr); map.removeLayer(extinctLyr); } return false; } // when refugee layer is checked, turn off other layers lyrs._layerControlInputs[lcnum_refugeeLyr].addEventListener('click',onLayerChange.bind(this,lcnum_refugeeLyr),false); lyrs._layerControlInputs[lcnum_LangResLyr].addEventListener('change',onLayerChange.bind(this,lcnum_LangResLyr,false)); // listen on fired error or catch error in prev promise map.on('simpleMapScreenshoter.error', function (event) {console.log(event.e.toString());}) map.on(L.Draw.Event.CREATED, function (e) { //console.log('~~~~~~~~~~~~~~~~~~~~ start map.on draw event ~~~~~~~~~~~~~~'); drawEvent = true; var layer = e.layer; drawnItems.addLayer(layer); //console.log('~~~~~~~~~~~~~~~~~~~~ end map.on draw event ~~~~~~~~~~~~~~'); }); map.on('click', onMapClick); //console.log("search str: " + srch) //set for phone //alert(document.body.clientWidth); if (document.body.clientWidth < 900) {sidebar.close();} else {sidebar.open('searchPane');} //set sidebar iframe size function fit() { let winHT = window.innerHeight; let legend_offset = 58; let o = document.getElementById('legendFrm'); if(o) o.style.height = (winHT - legend_offset) + 'px'; let offset = -230; o = document.getElementById('searchLangFrame'); if(o) o.style.height = (winHT - offset) + 'px'; o = document.getElementById('searchCntryFrame'); if(o) o.style.height = (winHT - offset - 40) + 'px'; let help_offset = 120; o=document.getElementById('helpFrm'); if(o) o.style.height = (winHT - help_offset) + 'px'; requestAnimationFrame(fit); } document.getElementById('usage').src = getSrc(); addEventListener("load", requestAnimationFrame.bind(this, fit)); async function googleTranslateElementInit(sLang) { let idxL = 0; if (typeof sLang == "undefined") {sLang='en'}; //if (sLang == 'es'){idxL = 1}; let g = await google.translate.TranslateElement({ pageLanguage: 'en', includedLanguages: 'en,es', autoDisplay: false //true //layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element'); if (g) { gte = document.querySelector("#google_translate_element select"); gte.selectedIndex = idxL; gte.dispatchEvent(new Event('change')); } includeHTML("includeHelp","help/helpinfo_"+sLang+".txt"); //document.getElementById('HelpVideo').src = '/cgi-bin/grn3/helpVideoList.php?l='+sLang; //console.log('language: '+sLang); } //document.getElementById('helpLang').selectedIndex = 1; //Fdocument.getElementById('helpLang').selectedIndex = 0; //setTimeout(hideGoogle, 1000); language='en'; if (srch) { window.history.replaceState({},document.getElementsByTagName('title')[0].innerHTML+ 'x',window.location.origin + window.location.pathname) //srch=''; close_video(); t = srch.split('='); if (t.length == 2) { if(t[0].startsWith('?lang')) { closeLangDiv(); prsrcURL = searchURL+'/language/'+t[1]; findLang(t[1]); }else if(t[0].startsWith('?GRN') || t[0].startsWith('?grn')){ closeLangDiv(); prsrcURL = searchURL+'/language/'+t[1]; findIsoFromNum(t[1]) }else if (t[0].startsWith('?country')){ if (cntry == 'all'){ cntry = t[1]; closeCntryDiv(); prsrcURL = searchURL+'/country/'+t[1]; findCntry(t[1],1); } else { cntry = 'all'; } } } }else{ //startupCookies(); }
OSZAR »