Esempio n. 1
0
function Map2GE($x, $y)
{
    if (0) {
        $SHM_KEY = ftok(__FILE__, chr(4));
        $data = shm_attach($SHM_KEY, 102400, 0666);
        $result = shm_get_var($data, 1);
        $r = $result[$x][$y];
        if (isset($r)) {
            shm_detach($data);
            return $r;
        }
    }
    // ­×¥¿
    $r = t67to97($x, $y);
    $x = $r[0];
    $y = $r[1];
    $proj = "proj -I +proj=tmerc +ellps=aust_SA +lon_0=121 +x_0=250000 +k=0.9999";
    $ret = shell_exec("echo {$x} {$y} | {$proj}");
    if (preg_match("/(\\d+)d(\\d+)'([\\d.]+)\"E\\s+(\\d+)d(\\d+)'([\\d.]+)\"N/", $ret, $matches)) {
        list($junk, $ed, $em, $es, $nd, $nm, $ns) = $matches;
        $r[0] = $ed + $em / 60 + $es / 3600;
        $r[1] = $nd + $nm / 60 + $ns / 3600;
        if (0) {
            $result[$x][$y] = $r;
            shm_put_var($data, 1, $result);
            shm_detach($data);
        }
        return $r;
    }
    return FALSE;
    // exit;
}
Esempio n. 2
0
function proj_67toge($p)
{
    $x = $p[0];
    $y = $p[1];
    $r = t67to97($x, $y);
    $x = $r[0];
    $y = $r[1];
    $proj = "proj -I +proj=tmerc +ellps=aust_SA +lon_0=121 +x_0=250000 +k=0.9999";
    $ret = shell_exec("echo {$x} {$y} | {$proj}");
    list($x, $y) = preg_split("/\\s+/", $ret);
    $r = dms2deg($x, $y);
    return $r;
}
Esempio n. 3
0
function Demo_TW()
{
    $p = array(282745, 2641869);
    print_r($p);
    echo "cs2cs法:\n";
    $p1 = cs2cs_t67to97($p[0], $p[1], 0);
    print_r($p1);
    echo "cs2cs法 invert:\n";
    $pp = cs2cs_t97to67($p1[0], $p1[1], 0);
    print_r($pp);
    echo "平面四參數轉換:\n";
    $p1 = t67to97($p[0], $p[1]);
    print_r($p1);
    echo "平面四參數轉換 Invert:\n";
    $p2 = t97to67($p1[0], $p1[1]);
    print_r($p2);
    echo "使用平面四參數轉換:\n";
    $q = proj_67toge($p);
    print_r($q);
    echo "使用 cs2cs:\n";
    $q1 = proj_67toge2($p);
    print_r($q);
}