Mapscript PostGIS

Giridhar Manepalli gmanepal at GMAIL.COM
Sat Apr 2 15:02:28 EST 2005


Hello All,

Usually with Mapserver CGI, we do
CONNECTIONTYPE POSTGIS
CONNECTION "blah blah blah"
Data "<geom> from <table>"

to render onto an image.

How is it possible to create the same thing, but this time the DATA
should be using Mapscript /PHP

something like :
$mapObj = ms_newMapObj('<map file>');
$imageObj = $mapObj->draw();
$layerObj = $mapObj->getLayerByName('<layer name>');
$sql = "SELECT <geom> from <TABLE>
$rs = odbc_exec($conn, $sql);

$polygons = array();
# use this $rs to create a layer of POLYGONS. It means that <geom> is
of type POLYGON. Thus $rs has to be populated in $polygons

# something like
foreach ($polygons => $poly) {
# Draw the $poly onto the image
}

In essense, how do I get the shape information of polygons from the
database using mapscript.

Thanks in advance,.

Giridhar



More information about the mapserver-users mailing list