MapScript essentials

Diego Efe diegoefe at YAHOO.COM
Thu Dec 22 10:11:11 EST 2005


Hi everybody,

            First let me tell you that I hardly speak
english and that this is the first time I join a list,
so if a make a mistake and upset somebody, please let
me know and I'll try to rectify my behaviour. Thanks.

My questions (I'm using PHP MapScript):
How can query a group of shape files and get the
contents of their corresponding .dbf's to, then, query
a datasource (Database, dbf, etc).
I've tried this code:

$map = ms_newMapObj($map_file, $map_path);
...

for($i=0; $i<$map->numlayers; ++$i) {
	$layer=$map->getLayer($i);
	printf("% 2d %s",($i+1),$layer->name.':
type['.layer_type($layer).'],
status['.layer_status($layer)."]");
	if($my_extent && $layer->isVisible()) {
		if(@$layer->queryByRect($my_extent)==MS_SUCCESS) {
			$nres=$layer->getNumResults();
			if($nres) {
				$layer->open();
				for($x=0; $x<$nres; ++$x) {
					//$layer->getShape($r->shapeindex,
$r->tileindex);	// got errors with this one
					$shape=$layer->getShape($x, 0);
					var_dump($shape);
				}
				$layer->close();
			}
		}
	}
}

This is part of a app that zoom, pans and switches
layers on/off (the things I've did so far).
I have two problems:
1) I seem to get only the first record of the .dbf
2) I'm using a precompiled version of Linux HostGis
2.4.31 with MapServer 4.6.0 and the documentation in
http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class
the layerObj has much more methods and properties than
what I got in my installation.

Thanks in advance for any help.

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 



More information about the mapserver-users mailing list