[Gfoss] insert polygon - p.mapper

Salvator*eL*arosa s_larosa a libero.it
Gio 22 Maggio 2008 10:50:52 CEST


Salve a tutti,

Secondo voi è possibile modificare questa funzione
per far inserire un poligono all'interno del DB da p.mapper:

function DB_addPoint($imgxy, $stato, $uso)
{   
    $db_host = "localhost";  
    $db_type = "pgsql";
    $db_name = "cms";
    $db_user = "postgres";
    $db_pwd  = "";
    
    $dsn = "$db_type://$db_user:$db_pwd@$db_host/$db_name";
    
    // CONVERT PIXEL X/Y TO MAP UNITS
    $imgxy_arr = explode(" ", $imgxy);
    $x_pix = $imgxy_arr[0];
    $y_pix = $imgxy_arr[1];   //"per esempio: se aumento l'array 
                                       //come posso modificare l'SQL per
l'inserimento"
        
    $GEOEXT = $_SESSION["GEOEXT"];
    $geoDeltaX = $GEOEXT["maxx"] - $GEOEXT["minx"];
    $geoDeltaY = $GEOEXT["maxy"] - $GEOEXT["miny"];
    
    $mapW = $_SESSION["mapwidth"];
    $mapH = $_SESSION["mapheight"];
    
    $x_geo = round($GEOEXT["minx"] + (($x_pix/$mapW)*$geoDeltaX));
    $y_geo = round($GEOEXT["maxy"] - (($y_pix/$mapH)*$geoDeltaY)); 

    
        
    
    // CONNECT TO DB AND RUN QUERY
    $geometry = "GeomFromText('POINT($x_geo $y_geo)',3004)";  
    $sql = "INSERT INTO domande(stato,uso,geom)
VALUES('$stato','$uso',$geometry)";
    //error_log ($sql);
    
    $dbh = dbConnect($dsn);
    $result = $dbh->query($sql);

    // Check that $result is not an error
    if (DB::isError($result)) {
        $dbh->disconnect();
        return ($result->getMessage());
    } else {
        $dbh->disconnect();
        return 1;
    }
    
    
}

Questa è relativa all'inserimento di un punto!

Grazie

-----
Salvatore Larosa
GPG: 0xE504BBE2 (FP: D9B2 CA87 81CD 1B91 E24D 3B42 D0F7 FA01 E504 BBE2)
-- 
View this message in context: http://www.nabble.com/insert-polygon---p.mapper-tp17399590p17399590.html
Sent from the Gfoss mailing list archive at Nabble.com.




Maggiori informazioni sulla lista Gfoss