$bg->includePolygons(false); unset($cleaned["contour"]); } elseif ($z <= 9) { $bg->addWayFilter("highway", "motorway,trunk,primary,secondary," . "motorway_link,primary_link,secondary_link," . "trunk_link"); $bg->addWayFilter("railway", "rail,preserved"); $bg->addWayFilter("waterway", "river"); $bg->addPOIFilter("place", "city,town"); $bg->includePolygons(false); unset($cleaned["contour"]); } elseif ($z <= 11) { $bg->addWayFilter("highway", "motorway,trunk,primary,secondary,tertiary,unclassified," . "motorway_link,trunk_link,primary_link,secondary_link," . "tertiary_link,unclassified_link"); $bg->addWayFilter("railway", "rail,preserved"); $bg->addWayFilter("waterway", "river"); $bg->addPOIFilter("place", "city,town,village"); $bg->addPOIFilter("railway", "station"); unset($cleaned["contour"]); } $data = $bg->getData($cleaned, CONTOUR_CACHE . "/{$kg}/{$z}/{$x}/{$y}.json", CACHE . "/{$kg}/{$z}/{$x}/{$y}.json", $x, $y, $z); $data["granularity"] = $kg; $data["bbox"] = array($sw['lon'] - 0.01, $sw['lat'] - 0.01, $ne['lon'] + 0.01, $ne['lat'] + 0.01); echo "onKothicDataResponse(" . json_encode($data) . ",{$z},{$x},{$y});"; } else { header("Content-type: application/json"); $bg = new BboxGetter($bbox, "3857", $outProj, $ext, null, $tbl_prefix); // mapsforge rendering test if ($mftest == 1) { $bg->addWayFilter("designation", "public_bridleway"); } $data = $bg->getData($cleaned, null, null); echo json_encode($data); }
<?php require_once '../lib/functionsnew.php'; require_once '../0.6/ws/DataGetter.php'; require_once '../0.6/ws/DBDetails.php'; require_once 'copyrights.php'; $cleaned = clean_input($_REQUEST); $bbox_in = explode(",", $cleaned["bbox"]); $inProj = $cleaned["inProj"]; $sw = reproject($bbox_in[0], $bbox_in[1], $inProj, "3857"); $ne = reproject($bbox_in[2], $bbox_in[3], $inProj, "3857"); $bbox = array($sw[0], $sw[1], $ne[0], $ne[1]); $outProj = $cleaned["outProj"]; adjustProj($outProj); $conn = pg_connect("dbname=gis user=gis"); header("Content-type: application/json"); header("Access-Control-Allow-Origin: http://www.free-map.org.uk"); $dbd = new DBDetails(null, array("table" => "hampshire", "col" => "the_geom"), null, null, null, null); $dbd->setIntersection(false); $bg = new BboxGetter($bbox, null, $dbd, 3857); $bg->includePolygons(false); $data = $bg->getData(array("way" => "all"), null, null, $outProj); $counties = $bg->getUniqueList("county"); $arr = array(); foreach ($counties as $county) { $arr[$county] = getCopyright($county); } $bg->setCopyright($arr); $data = $bg->simpleGetData(); echo json_encode($data); pg_close($conn);
adjustProj($inProj); adjustProj($outProj); if (isset($cleaned['inUnits']) && $cleaned['inUnits'] == 'microdeg' && $inProj == '4326') { for ($i = 0; $i < 4; $i++) { $values[$i] /= 1000000.0; } } // Native projection of DB is 900913 (Google Mercator) // 041114 ensure reprojected bbox completely contains original bbox by // taking the min and max eastings and northings of each corner list($sw['e'], $sw['n']) = reproject($values[0], $values[1], $inProj, '900913'); list($nw['e'], $nw['n']) = reproject($values[0], $values[3], $inProj, '900913'); list($ne['e'], $ne['n']) = reproject($values[2], $values[3], $inProj, '900913'); list($se['e'], $se['n']) = reproject($values[2], $values[1], $inProj, '900913'); $bbox = array(min($sw["e"], $nw["e"]), min($sw["n"], $se["n"]), max($ne["e"], $se["e"]), max($ne["n"], $nw["n"])); $bg = new BboxGetter($bbox, $inProj, $outProj); $data = $bg->getData($cleaned, null, null, $outProj); switch ($format) { case "geojson": case "json": header("Content-type: application/json"); echo json_encode($data); break; default: header("Content-type: text/xml"); echo '<?xml version="1.0"?>'; echo "<pre>"; to_xml($data); echo "</pre>"; break; }
exit; } adjustProj($inProj); adjustProj($outProj); if (isset($cleaned['inUnits']) && $cleaned['inUnits'] == 'microdeg' && $inProj == '4326') { for ($i = 0; $i < 4; $i++) { $values[$i] /= 1000000.0; } } // Native projection of DB is 900913 (Google Mercator) // 041114 ensure reprojected bbox completely contains original bbox by // taking the min and max eastings and northings of each corner list($sw['e'], $sw['n']) = reproject($values[0], $values[1], $inProj, '900913'); list($nw['e'], $nw['n']) = reproject($values[0], $values[3], $inProj, '900913'); list($ne['e'], $ne['n']) = reproject($values[2], $values[3], $inProj, '900913'); list($se['e'], $se['n']) = reproject($values[2], $values[1], $inProj, '900913'); $bbox = array(min($sw["e"], $nw["e"]), min($sw["n"], $se["n"]), max($ne["e"], $se["e"]), max($ne["n"], $nw["n"])); $bg = new BboxGetter($bbox); $data = $bg->getData($cleaned, null, null, $outProj == '900913' ? null : $outProj); switch ($format) { case "geojson": case "json": header("Content-type: application/json"); echo json_encode($data); break; default: header("Content-type: text/xml"); echo '<?xml version="1.0"?>'; to_xml($data); break; }