\t\t<p>Number of cells: <b><NUMCELLS></b>, number occupied: <b><NUMCELLSOCCUPIED></b></p> \t </body> \t</html> EOT; $template = str_replace('<NAME>', $name, $template); $template = str_replace('<GEOJSON>', json_encode($geojson), $template); $template = str_replace('<LATITUDE>', $min_lat + ($max_lat - $min_lat) / 2, $template); $template = str_replace('<LONGITUDE>', $min_long + ($max_long - $min_long) / 2, $template); $template = str_replace('<NUMCELLS>', $num_cells, $template); $template = str_replace('<NUMCELLSOCCUPIED>', $num_cells_occupied, $template); echo $template; } $name = ''; if (isset($_GET['name'])) { $name = $_GET['name']; draw_map($name); } else { $template = <<<EOT \t<!DOCTYPE html> \t<html> \t <head> \t\t<title>Map maker</title> \t\t<meta name="viewport" content="initial-scale=1.0, user-scalable=no"> \t\t<meta charset="utf-8"> \t\t<style> \t\tbody { font-family: sans-serif; } \t\t</style> \t </head> \t <body> \t <h1>Make map for a species using GBIF data</h1> \t <form action=".">
// razmer ego $xm = 0 - ($p_x * 2 - 1) + ($depth * 2 + 1); $ym = 0 - ($p_y * 2 - 1) + ($depth * 2 + 1); //$xm = 0 - $p_x + $depth; //$ym = 0 - $p_y + $depth; $size = $depth * 5 + 1; //$size = $depth * 2 + 1; $map = array(); for ($i = 0; $i < $size; $i++) { for ($j = 0; $j < $size; $j++) { $map[$i][$j] = ' '; } } $mas = connected_locs($p_x, $p_y, $depth); // teperq pereobrazuem eto v kartu: $map = draw_map($map, $mas, $tile); $fm = '<table border=1px>'; for ($i = $size - 1; $i > -1; $i--) { $fm .= '<tr>'; for ($j = 0; $j < $size; $j++) { $fm .= '<td>' . $map[$i][$j] . '</td>'; } $fm .= '</tr>'; } $fm .= '</table>'; echo $fm; function draw_map($map, $mas, $tile) { global $xm; global $ym; global $sid;