1 |
<?php
|
2 |
set_time_limit(600);
|
3 |
require_once("mapExtract.class.php");
|
4 |
$bbox=split(',',urldecode($HTTP_GET_VARS['bbox']));
|
5 |
if (count($bbox) == 4) {
|
6 |
$mapextract = new mapExtract();
|
7 |
$mapextract->setBbox($bbox[0], $bbox[1], $bbox[2], $bbox[3]);
|
8 |
$fp=fopen('php://output','w');
|
9 |
$mapextract->setInput('../../planet.bin');
|
10 |
$mapextract->setOutputFD($fp);
|
11 |
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
|
12 |
header('Content-Type: application/force-download');
|
13 |
else
|
14 |
header('Content-Type: application/octet-stream');
|
15 |
$name='osm_bbox_';
|
16 |
$name.=round($bbox[0],1) . ',' . round($bbox[1],1) . ',';
|
17 |
$name.=round($bbox[2],1) . ',' . round($bbox[3],1);
|
18 |
$name.='.bin';
|
19 |
header("Content-disposition: attachment; filename=\"$name\"");
|
20 |
$error=$mapextract->process();
|
21 |
if ($error) {
|
22 |
header('Content-Type: text/plain');
|
23 |
echo $error;
|
24 |
}
|
25 |
fclose($fp);
|
26 |
} else {
|
27 |
#echo "<pre>";
|
28 |
#print_r($HTTP_HOST);
|
29 |
#echo "</pre>";
|
30 |
$areas=array(
|
31 |
'Germany' => '5,47,16,55.1',
|
32 |
);
|
33 |
$url='http://' . $HTTP_SERVER_VARS['HTTP_HOST'] . $HTTP_SERVER_VARS['PHP_SELF'];
|
34 |
echo "Use: $url?bbox=bllon,bllat,trlon,trlat <br />\n";
|
35 |
echo "<br />\n";
|
36 |
while (list($area,$bbox)=each($areas)) {
|
37 |
$urlf=$url . "?bbox=$bbox";
|
38 |
echo "$area <a href='$urlf'>$urlf</a><br />\n";
|
39 |
}
|
40 |
|
41 |
}
|
42 |
?>
|