Accessing class properties in PHP/MapScript

Camden Daily cdaily at GMAIL.COM
Tue Feb 1 10:06:34 PST 2005


I'm having some strange problems with accessing the member properties
of my classes with php/mapscript.

I was initially having issues with using queryByPoint against points
added to a layer with addFeature.  I'd see some perl/mapscript
solutions, but they involved directly setting an index value for each
point shape.  In PHP, it's not possible to directly set the index
value (the set() function complains that it's read-only).

I looked at the mapscript source, and adjusted the shape->set()
function to allow me to set the index, and now things work fine for
that.  I'm curious if anyone knows why I'd be getting strange behavior
in accessing the class attributes directly, for example using
$shape->index. or $shape->values.  If I set a class attribute in this
manner and then echo the value back, it looks like it's worked, but
the values don't 'stick'.  When I access the class later, such as with
$layer->getShape(), the values are no longer within the object.

I'm just a little lost on this.  It appears that in perl/mapscript
these attributes are directly accessible?



More information about the MapServer-users mailing list