'); mywindow.print(); mywindow.close(); return true; } //grab html content to print function printMe(){ var print = $(".print").html(); return print; } // Loading racial geojson file function ashviewOnEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: ashviewResethighlight, /*click: zoomToFeature*/ }); } function washingtonOnEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: washingtonResethighlight, /*click: zoomToFeature*/ }); } function aucOnEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: aucResethighlight, /*click: zoomToFeature*/ }); } function vineOnEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: vineResethighlight, /*click: zoomToFeature*/ }); } function englishOnEachFeature(feature, layer) { layer.on({ mouseover: highlightFeature, mouseout: englishResethighlight, /*click: zoomToFeature*/ }); } function beltlineOnEachFeature(feature, layer) { layer.on({ click: zoomToFeature }); } $.ajax({ type: "GET", url: "geojson/beltine_v2.geojson", dataType: "json", async:false, success: function(data) { console.log('data'); beltlineFeature = L.geoJSON(data,{ style:{ "color": "black", "weight": 2, "opacity": 1 } //onEachFeature: beltlineOnEachFeature }); beltlineFeature.addTo(beltline); map.addLayer(beltline); }, error: function(response) { console.log(response); } }); $.ajax({ type: "GET", url: "geojson/WashingtonPark.geojson", dataType: "json", async:false, success: function(data) { console.log("n data"); washingtonFeature = L.geoJSON(data, { onEachFeature: washingtonOnEachFeature, style: { "color":"blue", "weight": 5, "fillOpacity": .3 } }); washingtonFeature.addTo(map); }, error: function(response) { console.log(response); } }); $.ajax({ type: "GET", url: "geojson/AUC.geojson", dataType: "json", async:false, success: function(data) { console.log("n data"); aucFeature = L.geoJSON(data, { onEachFeature: aucOnEachFeature, style: { "color":"Tomato", "weight": 5, "fillOpacity": .3 } }); aucFeature.addTo(map); }, error: function(response) { console.log(response); } }); $.ajax({ type: "GET", url: "geojson/EnglishAve.geojson", dataType: "json", async:false, success: function(data) { console.log("n data"); englishFeature = L.geoJSON(data, { onEachFeature: englishOnEachFeature, style: { "color":"Teal", "weight": 5, "fillOpacity": .3 } }); englishFeature.addTo(map); }, error: function(response) { console.log(response); } }); $.ajax({ type: "GET", url: "geojson/AshviewHeights.geojson", dataType: "json", async:false, success: function(data) { console.log("n data"); ashviewFeature = L.geoJSON(data, { onEachFeature: ashviewOnEachFeature, style: { "color":"Orange", "weight": 5, "fillOpacity": .3 } }); ashviewFeature.addTo(map); }, error: function(response) { console.log(response); } }); $.ajax({ type: "GET", url: "geojson/VineCity.geojson", dataType: "json", async:false, success: function(data) { console.log("n data"); vineFeature = L.geoJSON(data, { onEachFeature: vineOnEachFeature, style: { "color":"Magenta", "weight": 5, "fillOpacity": .3 } }); vineFeature.addTo(map); }, error: function(response) { console.log(response); } }); // Loading economic geojson file function getFillColorProp(d){ //console.log('select fill color'); if(d=="1"){ //console.log('this col'); count++ return '#66ff33'; } else if(d=="NA"){ return '#EBEB00'; } else{ return 'red'; } } function getColorProp(d){ //console.log('select color'); if(d=="1" || d=="NA"){ return 'black'; } else{ return 'red'; } } function getInfo(p, e, s){ if(p!=""){ console.log("Inside get info"); var disp=document.getElementsByClassName("map-overlay"); disp[0].style.maxHeight="660px"; disp[0].style.display=""; var inf=document.getElementById("pd"); inf.style.padding="10px"; //clear the information in text box $("#pd").html(""); //console.log("first first first print: " + printMe); var result= new Array(); //grabbing values in modal fields if(s){ var owner=document.getElementsByName("owner")[0].value; var income=document.getElementsByName("income")[0].value; //var estimated=document.getElementsByName("estimated")[0].value; //var homestead=document.getElementsByName("homestead")[0].value; var occupant=document.getElementsByName("occupant")[0].value; var lien=document.getElementsByName("lien")[0].value; //hold query result //send all values to grab information from database //income:income, estimated:estimated, $.ajax({ type: "POST", url: 'index.php', data: { pid : p, owner:owner, homestead:homestead, occupant:occupant, lien:lien }, async: false, success: function(data) { try{ console.log("we have data"); //set query to result var result = JSON.parse(data); console.log(result); } catch(e){ console.log("failing"); //alert if no data is available (this happens if geojson data is not reflected in database) alert(data); } } }); } else{ console.log("trying to do post"); //alert(p); $.ajax({ type: "POST", url: 'index.php', data: { pid : p }, async: false, success: function(data) { try{ //set query to result var console.log("some data?"); result = JSON.parse(data); console.log(result); } catch(e){ console.log("no data in base"); //alert if no data is available (this happens if geojson data is not reflected in database) alert(data); } } }); } //************** DISPLAY INFORMATION IN DISPLAY BOX *************** function roundToTwo(num) { return +(Math.round(num)); } //****** ELIGIBILITY ******** if (result[0]['Eligibility'] == "0"){ disp[0].style.background="#DEB887"; $('#pd').append('
Not Eligible
'); } else if(result[0]['Eligibility'] == "1"){ disp[0].style.background="#66ff33"; $('#pd').append('
Eligible
'); } else{ disp[0].style.background="#FFFF66"; $('#pd').append('
Missing data
'); } $('#pd').append('

Address: '+result[0] ['Address']+'

'); $('#pd').append('

Owner: '+result[0]['Owner']+'

'); $('#pd').append('

 Property Tax Estimates

YearValue
2018'+roundToTwo(parseFloat(result[0]['tax18']))+'
2019'+roundToTwo(parseFloat(result[0]['tax19']))+'
2020'+roundToTwo(parseFloat(result[0]['tax20']))+'
2021'+roundToTwo(parseFloat(result[0]['tax21']))+'
2022'+roundToTwo(parseFloat(result[0]['tax22']))+'
2023'+roundToTwo(parseFloat(result[0]['tax23']))+'
2024'+roundToTwo(parseFloat(result[0]['tax24']))+'

'); //********* INCOME ********** if(e){ /* if(result[0]['eligible']=="1"){ console.log('entered if'); $('#pd').append('

Income :

'); } else{ $('#pd').append('

Income :

'); } */ $('#pd').append('

Estimated Income: $'+roundToTwo(parseFloat(result[0]['income']))+'

'); if(result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HA01" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HF01" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HF47F7" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HA01" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HA03" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HF01S" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HF07S" || result[0]['ATLANTA.HOMESTEAD.EXEMPTION.CODE']=="HA42"){ $('#pd').append('

Homestead :

'); } else{ $('#pd').append('

Homestead :

'); } if(result[0]['occupant']=="1"){ $('#pd').append('

Owner Occupant :

'); } else{ $('#pd').append('

Owner Occupant :

'); } if(result[0]['no_lien']=="0"){ $('#pd').append('

No liens :

'); } else if(result[0]['no_lien']=="NA"){ $('#pd').append('

No liens : ?

'); } else{ $('#pd').append('

No liens :

'); } } //set modal values in edit form from database var modalInfo=document.getElementsByName("owner"); modalInfo[0].value=result[0]['Owner']; modalInfo=document.getElementsByName("income"); modalInfo[0].value=result[0]['income']; if(result[0]['income']=="1"){ modalInfo[0].checked=true; } modalInfo=document.getElementsByName("estimated"); modalInfo[0].value=result[0]['income']; //modalInfo=document.getElementsByName("homestead"); //modalInfo[0].value=result[0]['ExCode']; if(result[0]['ExCode']!=" "){ modalInfo[0].checked=true; } modalInfo=document.getElementsByName("occupant"); modalInfo[0].value=result[0]['occupant']; if(result[0]['occupant']=="1"){ modalInfo[0].checked=true; } modalInfo=document.getElementsByName("lien"); modalInfo[0].value=result[0]['no_lien']; if(result[0]['Lien']=="0"){ modalInfo[0].checked=true; } else if(result[0]['Lien']=="1"){ $("#unsure").checked=true; } } } var edit=""; var lienCheck=document.getElementsByName("lien"); var unsureLien=document.getElementById("unsure"); // load GeoJSON for adt property information $.ajax({ type: "GET", url: "geojson/ADT_Data.geojson", dataType: "json", async:false, success: function(data) { console.log('adt'); /*var harbourIcon = L.icon({ iconUrl: 'images/red_dot.png', iconSize: [100, 50] });*/ L.geoJson(data, { pointToLayer: function(feature, latlng) { //return (commented out to stop displayed markers) if (feature.properties.eligible == "1"){ mark = L.circleMarker(latlng, { fillColor: getFillColorProp(feature.properties.eligible), color: getColorProp(feature.properties.eligible), weight:.75, radius: 5, fillOpacity:1, }); return mark.addTo(eligible); } else{ mark = L.circleMarker(latlng, { fillColor: getFillColorProp(feature.properties.eligible), color: getColorProp(feature.properties.eligible), weight:.75, radius: 5, fillOpacity:1, }); return mark.addTo(ineligible); } /*L.marker(latlng, { icon: harbourIcon });*/ //return mark.addTo(adt); }, onEachFeature: function onEachFeature(feature,layer){ //hide the "click a adt property" sentence layer.on('click', function (e) { //$("#overlay-header").html(""); $("#pd").html(""); $("#edit_button").html(""); $("#print_button").html(""); var modalInfo=document.getElementsByName("owner"); modalInfo[0].value=null; modalInfo=document.getElementsByName("income"); modalInfo[0].value=null; modalInfo[0].checked=false; modalInfo=document.getElementsByName("estimated"); modalInfo[0].value=null; modalInfo=document.getElementsByName("homestead"); modalInfo[0].value=null; modalInfo[0].checked=false; modalInfo=document.getElementsByName("occupant"); modalInfo[0].value=null; modalInfo[0].checked=false; lienCheck[0].value=null; lienCheck[0].checked=false; unsureLien.checked=false; unsureLien.value=null; //$("#timelineButton").html(""); //turn current json property into string var information = JSON.stringify(e.target.feature.properties,undefined,4); //$('#pd').append("

Address:

" + e.target.feature.properties.Address); //objectify string variable var result = JSON.parse(information); getInfo(result.ParcelID, false, false); var clickedButton=false; var sData=document.getElementById("sensitiveData"); sData.onclick=function(event){ console.log('display sensitive data'); event.preventDefault(); getInfo(result.ParcelID, true, false); sData.style.display="none"; clickedButton=true; }; $("body").mouseup(function(){ var cData=document.getElementById("sensitiveData"); if(clickedButton){ clickedButton=false; console.log('mouse click'); cData.style.display=""; getInfo(result.ParcelID, false, false); } }); if(edit!=""){ $('#edit_button').append("
edit
"); } else{ $('#edit_button').append("
edit
"); } //var printMe = $(".print").html(); //console.log("first print: " + printMe); $('#print_button').append("
print
"); var save=document.getElementById("save"); save.onclick=function(event){ event.preventDefault(); /*var logout="1"; alert(logout); if(logout){ edit=""; $("#edit_button").html(""); $('#edit_button').append("
Edit
"); $("#modal2").modal('close'); $("#loginModal").modal('open'); }*/ var modalInfo=document.getElementsByName("income"); if(modalInfo[0].checked==false){ modalInfo[0].value="0"; } else{ modalInfo[0].value="1"; } modalInfo=document.getElementsByName("homestead"); if(modalInfo[0].checked==false){ modalInfo[0].value=" "; } else{ modalInfo[0].value="H"; } modalInfo=document.getElementsByName("occupant"); if(modalInfo[0].checked==false){ modalInfo[0].value="0"; } else{ modalInfo[0].value="1"; } modalInfo=document.getElementsByName("lien"); if(modalInfo[0].checked==true){ modalInfo[0].value="1"; } else{ if(unsureLien.checked==true){ modalInfo[0].value="2"; } else{ modalInfo[0].value="0"; } } getInfo(result.ParcelID,false, true); }; if (highlight !== null && !highlight.getLatLng().equals(e.latlng)){ //set regular default icon highlight.removeFrom(map); highlight = L.marker(e.latlng, { icon: new clickedIcon }); highlight.addTo(map); } else{ highlight = L.marker(e.latlng,{ icon: new clickedIcon }); highlight.addTo(map); } proArr[0]=highlight; }); }, //on marker click, add or edit adt information //addTo(map).on("click",function(event){ }); //add both layers to map initially map.addLayer(eligible).addLayer(ineligible); }, error: function(response) { console.log("problem with geojson"); console.log(response); } }); lienCheck[0].onclick=function(event){ alert("toggle clicked"); unsureLien.checked=false; } unsureLien.onclick=function(event){ alert("unsure clicked"); lienCheck[0].checked=false; } //******** LOGIN FUNCTIONALITY ********** /* $("#login").submit(function(event){ event.preventDefault(); uname=document.getElementById("uname").value; psw=document.getElementById("psw").value; $.ajax({ type: "GET", url: 'php/logDoc.php', data: { uname : uname, psw: psw }, async: false, success: function(data) { try{ data=JSON.parse(data); alert(data); } catch(e){ $.ajax({ type: "POST", url: 'php/logCheck.php', data: { uname : uname}, async: false, success:function(d2){ try{ edit=JSON.parse(d2); $("#edit_button").html(""); $('#edit_button').append("
Edit
"); $("#loginModal").modal('close'); $("#modal2").modal('open'); } catch(e){ } } }); } } }); }); */ //************ ADD SIGN UP FUNCTIONALITY HERE ********** var legendmap = L.control({ position: 'bottomleft' }); //turn economic densities on and off legendmap.onAdd = function(map) { var div = L.DomUtil.create('div', 'info legend'), grades = [1,"NA",0], labels = ['Eligible','Missing data','Not Eligible']; // loop through our race percent intervals and generate a label with a colored square for each interval for(i=0; i: '+ (labels[i] ? labels[i] + '
' : '+'); } return div; }; legendmap.addTo(map); var info = L.control({ position: 'topright' }); info.onAdd = function (map) { this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info" this.update(); return this._div; }; // method that we will use to update the control based on feature properties passed info.update = function (props) { this._div.innerHTML = '

Neighborhood Name

' + (props ? '' +props.NAME : 'Hover over a neighborhood'); }; info.addTo(map); var infotwo = L.control({ position: 'bottomright' }); infotwo.onAdd = function (map) { this._div = L.DomUtil.create('div', 'infotwo'); // create a div with a class "info" //this.update(); this._div.innerHTML = '

Total Eligible:

' + count; return this._div; }; infotwo.addTo(map); var searchboxControl=createSearchboxControl(); var control = new searchboxControl({}); control._searchfunctionCallBack = function (searchkeywords) { for(i=0; i
edit
"); } else{ $('#edit_button').append("
edit
"); } //value in map overlay information box that needs to be printed //var printMe = $(".print").html(); $('#print_button').append("
print
"); var save=document.getElementById("save"); save.onclick=function(event){ event.preventDefault(); /*var logout="1"; alert(logout); if(logout){ edit=""; $("#edit_button").html(""); $('#edit_button').append("
Edit
"); $("#modal2").modal('close'); $("#loginModal").modal('open'); }*/ var modalInfo=document.getElementsByName("income"); if(modalInfo[0].checked==false){ modalInfo[0].value="0"; } else{ modalInfo[0].value="1"; } modalInfo=document.getElementsByName("homestead"); if(modalInfo[0].checked==false){ modalInfo[0].value=" "; } else{ modalInfo[0].value="H"; } modalInfo=document.getElementsByName("occupant"); if(modalInfo[0].checked==false){ modalInfo[0].value="0"; } else{ modalInfo[0].value="1"; } modalInfo=document.getElementsByName("lien"); if(modalInfo[0].checked==true){ modalInfo[0].value="1"; } getInfo(resq[0]['ParcelID'],false, true); }; if(!markerExists){ console.log('adding'); marker.addTo(map); map.setView([y,x],18); } } } }; map.addControl(control); map.zoomControl.setPosition('topleft'); L.control.navbar().addTo(map);