Record count
Abe Gillespie
agillesp at VT.EDU
Fri Jan 7 09:34:17 PST 2005
Is there a better way to get the total number of records in a shapefile
than query for all records and getting the result count a la:
$l->queryByAttributes("any_field", "/\w*/", MS_MULTIPLE);
$cnt = $l->getNumResults();
I realize you can use shapefileObj::numshapes, but this doesn't always
work for me. I don't want to use hard paths and have tried it like:
$path = $map->shapepath.$layer->data;
$file = ms_newShapefileObj($path, -1);
$cnt = $file->numshapes;
This works on some sites and not on others. I remember reading
something about Mapscript changing the current working directory. I
think this is causing me issues as I keep my map file in "etc" and the
HTML files one directory above that.
Thanks.
-Abe
More information about the MapServer-users
mailing list