New PHP Mapscript question layer->set("data", "my_layer")

John B. Churchill jchurchill at AL.UMCES.EDU
Thu Jun 7 13:49:52 EDT 2007


<?php

dl('php_mapscript.dll');

$interval = $_GET['q']; // q is the value of what was selected
$options = array();
$map_path="C:\\ms4w\\Apache\\htdocs\\img_browser\\";
$map_file="img_browser.map";
$map = ms_newMapObj($map_path.$map_file);
$layer = ms_newLayerObj($map);
$layer->set("name", "Landsat");
$layer->set("data", "landsat_4");

print $layer->numitems;

This gives me the following.
[]

I (the user) "EXPECTED" that layer->set would actually set $layer to the 
shapefile referenced in my Map file ... and that "numitems" would there 
for give me the number of fields/items/attributes in that shapefile.  Is 
that not the case ?

++++++++++++++++++++++++++++++++++++++++++++++++++
My Map file (img_browser.map) has this layer entry ...
   LAYER
   NAME landsat_4
   TYPE POLYGON
   DATA landsat_4
   STATUS ON
     CLASSITEM LOCATION
     CLASS
       NAME "Landsat Data"
       #STYLE
       #  COLOR 40 40 200
       #END
       STYLE
         OUTLINECOLOR 40 40 200
         WIDTH 1
         ANTIALIAS TRUE
       END
     END
     TEMPLATE "templates/landsat_4.html"
   END
-- 
---------------------------------------------
John B. Churchill, M.S.			http://alx.al.umces.edu/~jchurch/
GIS Specialist				(301) 689-7109

University of Maryland Center for Environmental Science
Appalachian Laboratory			http://www.al.umces.edu/
Environmental Science Education		http://alese.al.umces.edu/

301 Braddock Road			
Frostburg, MD 21532			
FAX - (301) 689-7200			



More information about the mapserver-users mailing list