[mapserver-users] Re: Mapscript

Jim Burnett jimburnett at ntelos.net
Sun Jan 13 15:01:03 EST 2002


I was thinking you would abtain the shape just like you would  a map, using
a Class expression, and it even looks like the shapeObj will do that, but it
doesnt seem to work.

dl("php_mapscript.so");
require "config.php";


$mapObj = ms_newMapObj("$mapfilePath/va_rockingham.map");
$layObj=$mapObj->getLayer(0);
$shapObj= ms_newShapeObj(2);
$img = $mapObj->prepareImage();

$tt = $shapObj->draw($mapObj,$layObj,$img,0,"");

if ( $tt ) {
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("content-type: image/png");
$img->saveImage("",MS_PNG,0,0, 80);
$img->free();
}else{
$lname = $layObj->name;
$numclasses = $layObj->numclasses;
$cObj = $layObj->getClass(0);
$cname = $cObj->name;
$shpidx = $shapObj->index;
print ":$tt:$lname::$numclasses::$cname::$shpidx";
die ;
}


-jim-
----- Original Message -----
From: "Daniel Morissette" <morissette at dmsolutions.ca>
To: "Jim Burnett" <jimburnett at ntelos.net>
Cc: "mapserver-users" <mapserver-users at lists.gis.umn.edu>
Sent: Friday, January 11, 2002 5:14 PM
Subject: Re: [mapserver-users] Re: Mapscript


> Jim Burnett wrote:
> >
> > I've been looking into using getShap(), but doesnt it require the index
of
> > the shape? Not all databases will have this Index. I think you can get
the
> > shap via a class, but the shapeObj doesnt seem to work correctly. Do you
> > have any sample code for drawing a shape, getting the shape by class,
not by
> > the shape index?
> >
>
> I think I see what you mean: reocrds obtained from a RDBMS won't carry a
> unique shape_id the same way as shapefiles and other file-based formats
> will.  So you don't have any shape_id to pass to getShape() after a
> query.  I don't know about SDE and PostGIS, but I have used SDO before
> (outside of the MapServer world) and I believe that there is nothing in
> OracleSpatial that can easily be mapped to a shape_id.
>
> I guess the best ones to answer this question are the developers of the
> SDO, SDE, and/or PostGIS connections:  Do the database-based connections
> in MapServer have any equivalent of a shape_id?  If not then what should
> one do to retrieve the shapes returned by a queryByPoint() in MapScript
> for instance?
>
> --
> ------------------------------------------------------------
>  Daniel Morissette               morissette at dmsolutions.ca
>  DM Solutions Group              http://www.dmsolutions.ca/
> ------------------------------------------------------------
>   Don't put for tomorrow what you can do today, because if
>       you enjoy it today you can do it again tomorrow.
>




More information about the mapserver-users mailing list