[postgis-users] viewer postgis with my mapfile (scripts)

Quentin Page Quentin.Page at ensg.eu
Sat Feb 28 05:11:08 PST 2009


I can see only the white page.
where is my problem

thank a lots

<?php
//connection BD
dl("php_mapscript.dll");
$hote="localhost";
$base="ICPE";
$utilisateur="postgres";
$motspase="postgres";


$XMIN="857816";
$XMAX="857916";
$YMIN="1856314";
$YMAX="1856414";


// table
$table="chemin";
$longueur_image="500";
$IMAGEPATH="C:/ms4w/tmp/ms_tmp";
$IMAGEURL="/ms_tmp/";

//connection postgis
$bd_handle=pg_connect("host=".$hote."
dbname=".$base." user=".$utilisateur."
password=".$motspase."");

//selection et extraction de l'info
$pgsql_col_geometrie="select wkb_geometry from chemin";
$pgsql_resultat=pg_exec($bd_handle, $pgsql_col_geometrie);
$colonne_geometrique=pg_result($pgsql_resultat,0,0);

//à rendre interactif
$type_de_donnee_geometrique_pour_mapserver=LINE;

//create mapfile
$Nom_Mapfile=$base.".map";
$file_mapfile=fopen($Nom_Mapfile,"w");
$texte_mapfile="
MAP
EXTENT 857816 857916 1856314 1856414
SIZE 620 432
IMAGECOLOR 255 255 255
IMAGETYPE PNG

WEB
                IMAGEPATH \"".$mapserver_imagepath."\"
                IMAGEURL \"".$mapserver_imageurl."\"
        END

LAYER
        NAME \"".$base."\"
        STATUS DEFAULT
        CONNECTIONTYPE POSTGIS
        CONNECTION \"user=".$utilisateur." dbname= ".$base." host=
".$hote."\"
        DATA \"".$colonne_geometrique." FROM ".$table." as foo using unique
ogc_fid using SRID=27582\"
        TYPE LINE
        CLASS
                OUTLINECOLOR 0 0 0
                SIZE 4
        END
END
END";
fputs($file_mapfile,$texte_mapfile);

//close mapfile
fclose($file_mapfile);

//use mapscript
$map=ms_newMapObj($Nom_Mapfile);$image=$map->draw();
$image_url=$image->saveWebImage();

//deconnection  serveur
pg_close($db_handle);
?>

<html>
<body>
<IMPUT TYPE=IMAGE NAME="MAPA" SRC"<?php echo $image_url ?>">
</body>
</html>






More information about the postgis-users mailing list