Call to undefined method getFeature

Pietro Giannini pgiannini at BYTEWISE.IT
Thu Jun 28 03:56:37 EDT 2007


Hi Christopher,

there is no mapscript function layerobj::getFeature(), maybe you need the
layeroby::getShape().

(Effectively getFeature is a more exact name for this function: a "shape"
don't have attributes, a "feature" is a shape with attributes)

take a look here:
http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class/classes/layerobj

ciao
.........................pg




Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E




> *Hi all,
>
> I'm having some trouble getting the getFeature method to work on a layer
> object. Here's the error I get:
>
> Fatal error*: Call to undefined method ms_layer_obj::getFeature() in
> *C:\ms4w\Apache\htdocs\test.php* on line *10
>
> And the php code:
>
> <?php
> dl("php_mapscript.dll");
> dl("php_dbase.dll");
> dl("php_curl.dll");
>
>
> $shape_id = 1;
> $map = ms_newMapObj("c:\ms4w\apache\htdocs\es.map");
> $this_layer = $map->getLayerByName('pn_points');
> $attribute = $this_layer->getFeature(1, -1);
> echo "ok";
> ?>
>
> and the mapfile:
>
> # This is our fifth map file
> NAME "es"
> UNITS meters
> EXTENT 167000 5814000 542300 5948000
> SIZE 640 480
> IMAGECOLOR 255 255 255
> IMAGETYPE PNG
> SHAPEPATH "c:\ms4w\apache\htdocs\wem\"
> FONTSET "c:\ms4w\apache\htdocs\fontset.txt"
>
> WEB
>     IMAGEPATH "/ms_temp/"
>     IMAGEURL "http://132.206.251.215/ms_temp/"
> END
>
> #####################################
> # placenames layer - points
> #
> LAYER
>     NAME "pn_points"
>     DATA "points_ID_real"
>     STATUS on
>     TYPE point
>     CLASS
>          STYLE
>               SIZE 1
>               COLOR 100 100 200
>          END
>     END
> END
>
>
> END # mapfile
>
> Any ideas? I'm totally stumped. I don't know if its the software
> (mapserver
> 4.10, mapscript 4.10, php 5)or a mistake I've made that is eluding me.
> *
>
> --
> Christopher Wellen
> M.Sc. Candidate
> Department of Geography
> McGill University
> Montreal, Quebec
> Burnside Hall room 428
> 805 Sherbrooke Street West
> Montreal, Quebec H3A 2K6
> skype: christopher.wellen
> MSN: christopher.wellen at mail.mcgill.ca
> home: 514-509-9476
> cell: 514-585-5138
>



More information about the mapserver-users mailing list