<?
$row = 1;
$buffer=array();
if (($handle = fopen("avaliacoes_coordenadas.csv", "r")) !== FALSE) {
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
			$buffer[]=$data;        
    }
    fclose($handle);
}
//print_r($buffer);
//die;
?>var arArvores=
	[<?
for($i=3;$i<count($buffer);$i++){
	if (trim($buffer[$i][1])!=""){
		$coords=explode(",",$buffer[$i][1]);
		?>{
			latitude:<?=trim($coords[0]);?>,
			longitude:<?=trim($coords[1]);?>,
			especie:"<?=(htmlspecialchars($buffer[$i][4]));?>",
			nomeComum:"<?=(htmlspecialchars($buffer[$i][5]));?>",
			local:"<?=(htmlspecialchars($buffer[$i][3]));?>",
			data:"<?=htmlspecialchars($buffer[$i][2]);?>",
			pap:<?=str_replace(",",".",htmlspecialchars($buffer[$i][6]));?>,
			nr:"<?=htmlspecialchars($buffer[$i][0]);?>",
			u:<?=$buffer[$i][7]=="-"||$buffer[$i][7]==""?"null":str_replace(",",".",htmlspecialchars($buffer[$i][7]));?>,
			w:<?=$buffer[$i][8]=="-"||$buffer[$i][8]==""?"null":str_replace(",",".",htmlspecialchars($buffer[$i][8]));?>,
			valorBase:"<?=htmlspecialchars($buffer[$i][9]);?>",
			els:"<?=str_replace(",",".",htmlspecialchars($buffer[$i][10]));?>",
			ele:"<?=str_replace(",",".",htmlspecialchars($buffer[$i][11]));?>",
			valorFinal:"<?=htmlspecialchars($buffer[$i][12]);?>"
		}<?
		if ($i<count($buffer)-1){
			?>,<?
		}
	}
}

?>];<?