$row['locX'], 'locY' => $row['locY']); } mysql_close(); //Width and height of each region $regionSize = 85; //Center on a coordinate $centerX = 19996; $centerY = 20001; //set X, Y upper bounds $maxX = 20004; $maxY = 20003; //set X, Y lower bounds $minX = 19995; $minY = 19996; //Create an image, properly sized $imageWidth = (($maxX-$minX)*$regionSize); $imageHeight = (($maxY-$minY)*$regionSize); $heading = ' '; //foreach region, plot square at position in image multiplied by region width foreach($regions as $regionName => $coords) { if($coords['locX'] > $minX AND $coords['locX'] < $maxX) { if($coords['locY'] > $minY AND $coords['locY'] < $maxY) { $rectangles .= ''; $text .= ''.$regionName.'X='.$coords['locX'].'Y='.$coords['locY'].''; } } } $ending = ''; $stringData = $heading.$rectangles.$text.$ending; $fh = fopen('map.svg', 'w'); fwrite($fh, $stringData); fclose($fh); exec('convert map.svg map.png'); echo '

' ?>