Пример #1
0
function makeTileCacheFile($user, $extentLayer = NULL)
{
    //return;
    global $basePath;
    global $postgisdb;
    global $postgishost;
    global $postgispw;
    global $hostName;
    global $postgisschema;
    $postgisdb = $user;
    $table = $extentLayer;
    $postgisObject = new postgis();
    $srs = "900913";
    $geomField = $postgisObject->getGeometryColumns($table, "f_geometry_column");
    if ($extentLayer) {
        $sql = "SELECT xmin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMin,xmax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMax, ymin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMin,ymax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMax  FROM " . $table;
        $result = $postgisObject->execQuery($sql);
        //print_r($postgisObject->PDOerror);
        $row = $postgisObject->fetchRow($result);
    }
    ob_start();
    echo "[cache]\n";
    echo "type=Disk\n";
    echo "base={$basePath}/tmp/{$user}\n\n";
    //echo "type=AWSS3\n";
    //echo "access_key=AKIAIZUYE3I462NPVANQ\n";
    //echo "secret_access_key=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\n";
    $sql = "SELECT * FROM settings.geometry_columns_view";
    //echo $sql;
    $result = $postgisObject->execQuery($sql);
    if ($postgisObject->PDOerror) {
        makeExceptionReport($postgisObject->PDOerror);
    }
    while ($row = $postgisObject->fetchRow($result)) {
        echo "[{$row['f_table_schema']}.{$row['f_table_name']}]\n";
        echo "type=WMS\n";
        echo "url=http://127.0.0.1/cgi-bin/mapserv?map={$basePath}/wms/mapfiles/{$user}_{$row['f_table_schema']}.map\n";
        echo "extension=png\n";
        echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n";
        echo "maxResolution=156543.0339\n";
        echo "metaTile=yes\n";
        echo "metaSize=5,5\n";
        echo "srs=EPSG:900913\n\n";
    }
    $data = ob_get_clean();
    @unlink("{$basePath}wms/cfgfiles/{$user}.tilecache.cfg");
    $newFile = "{$basePath}wms/cfgfiles/{$user}.tilecache.cfg";
    $fh = fopen($newFile, 'w');
    fwrite($fh, $data);
    fclose($fh);
}
Пример #2
0
 function getUtmZone($table, $field, $value)
 {
     $query = "SELECT X(Centroid(the_geom)) as x FROM {$table} WHERE {$field}={$value}";
     $result = $this->execQuery($query);
     $row = postgis::fetchRow($result);
     $zone = floor((180 + $row['x']) / 6);
     if ($zone < 10) {
         $zone = "0" . $zone;
     }
     return $zone;
 }
Пример #3
0
    foreach ($rowsLpDel as $lpDels) {
        if ($lpDels[$key]) {
            $delExist = true;
        }
    }
    if ($row[$key] && substr($key, 0, 5) != "bilag" or $delExist) {
        $delExist = false;
        ?>
		
		<?php 
        if ($open == "true") {
            $open = "false";
        }
        if ($lp_ref[$key]) {
            $query = "SELECT distinct(textvalue) as textvalue FROM {$lp_ref[$key]} where fieldkey='{$row[$key]}'";
            $ref = $postgisObject->fetchRow($postgisObject->execQuery($query));
            $row[$key] = $ref["textvalue"];
        }
        $split = explode("#", $row[$key]);
        echo "<div id='{$key}' class='paragraph' style='display:none'><table border='0' cellspacing='10'>";
        echo "<div><h3>{$i} {$lp_fields[$key]}</h3></div>";
        foreach ($split as $num => $text) {
            $text = html_entity_decode($text);
            $text = str_replace("<p>", "", $text);
            $text = str_replace("</p>", "<br/>", $text);
            if (substr($text, 0, 6) == "&nbsp;") {
                $text = substr_replace($text, "", 0, 6);
            }
            if (sizeof($split) > 1) {
                if ($num) {
                    echo "<tr valign='top'><td>{$i}.{$num}</td><td>" . trim($text) . "</td></tr>";
Пример #4
0
function makeTileCacheFile($user, $extentLayer = NULL)
{
    //return;
    global $basePath;
    global $postgisdb;
    global $postgishost;
    global $postgispw;
    global $hostName;
    global $postgisschema;
    $postgisdb = $user;
    $table = $extentLayer;
    $postgisObject = new postgis();
    $srs = "900913";
    $geomField = $postgisObject->getGeometryColumns($table, "f_geometry_column");
    if ($extentLayer) {
        $sql = "SELECT xmin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMin,xmax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TXMax, ymin(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMin,ymax(EXTENT(transform(" . $geomField . ",{$srs}))) AS TYMax  FROM " . $table;
        $result = $postgisObject->execQuery($sql);
        //print_r($postgisObject->PDOerror);
        $row = $postgisObject->fetchRow($result);
    }
    ob_start();
    echo "[cache]\n";
    echo "type=Disk\n";
    echo "base={$basePath}/tmp/{$user}\n\n";
    //echo "type=AWSS3\n";
    //echo "access_key=AKIAIZUYE3I462NPVANQ\n";
    //echo "secret_access_key=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\n";
    //echo "db={$user}\n";
    $sql = "SELECT * FROM settings.geometry_columns_view";
    $result = $postgisObject->execQuery($sql);
    if ($postgisObject->PDOerror) {
        makeExceptionReport($postgisObject->PDOerror);
    }
    while ($row = $postgisObject->fetchRow($result)) {
        $layerArr[] = $row['f_table_schema'] . "." . $row['f_table_name'];
        $def = json_decode($row['def']);
        $def->meta_tiles == true ? $meta_tiles = "yes" : ($meta_tiles = "no");
        $def->ttl < 120 ? $expire = 120 : ($expire = $def->ttl);
        echo "[{$row['f_table_schema']}.{$row['f_table_name']}]\n";
        echo "type=WMS\n";
        echo "url={$hostName}/wms/{$user}/{$row['f_table_schema']}/?";
        echo "extension=png\n";
        echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n";
        echo "maxResolution=156543.0339\n";
        echo "metaBuffer=20\n";
        echo "metaTile={$meta_tiles}\n";
        echo "metaSize=3,3\n";
        echo "srs=EPSG:900913\n";
        echo "expire={$expire}\n\n";
    }
    echo "[{$postgisschema}]\n";
    echo "layers=" . implode(",", $layerArr) . "\n";
    echo "type=WMS\n";
    echo "url={$hostName}/wms/{$user}/{$postgisschema}/?TRANSPARENT=FALSE&";
    echo "extension=png\n";
    echo "bbox=-20037508.3427892,-20037508.3427892,20037508.3427892,20037508.3427892\n";
    echo "maxResolution=156543.0339\n";
    echo "metaBuffer=20\n";
    echo "metaTile={$meta_tiles}\n";
    echo "metaSize=3,3\n";
    echo "srs=EPSG:900913\n";
    echo "expire={$expire}\n\n";
    $data = ob_get_clean();
    @unlink("{$basePath}wms/cfgfiles/{$user}.tilecache.cfg");
    $newFile = "{$basePath}wms/cfgfiles/{$user}.tilecache.cfg";
    $fh = fopen($newFile, 'w');
    fwrite($fh, $data);
    fclose($fh);
}