point query and new layer

Daniel Morissette morissette at dmsolutions.ca
Tue Nov 14 16:07:37 EST 2000

Sven Kroemeke wrote:
> 1) the point query problem:
> I read many questions about it, but is it solved?


I'm not sure which problem you're talking about... I guess I'll let
someone who knows about it get back to you.

> 2) how can I create a new shape? (php, please)

See mapserver/mapscript/php3/test_writeshape.phtml in the mapserver
source distribution.

> 2)How is the php mapscript syntax?
> (this question is related to the two others)
> I never used objects in php before, so I just took some
> examples and used them, and it seemed to work. The
> variables are set! Most of the examples are Perl, so I
> used $layer->set(property,value);
> but also $layer->property=value; seemed to work!

Good question! I think this is worth a clarification.

In PHP, you should be able to set object properties using
$layer->property=value.  However, since PHP MapScript is a wrapper on
top of MapServer structures, setting properties this way does not
propagate to the C structures and has no effect (there's no way to set a
callback on a property change internally).  That's why we added the
set() method on all classes.

> Further more I found that $layer->getclass() is not documented
> in mapscript(PHP) (maybe more functions??)!

You're right... $layer->getClass(int classIndex) is not documented...
we'll add it.

> To set an annotation I found a description how to annotate
> a layer using the property (annotate), but it doesn't work
> with the set(,) function, because it doesn't seem to exist!?

There may have been some changes with respect to that between version
3.3.011 and the current version (not sure?).  For sure layerObj does not
have an 'annotate' member in the latest version of MapServer.

> 3) How can I change properties in the mapfile on the fly?
> Due to the problems above I also couldn't change existing
> layers, class properties ... the variables are set but
> nothing changes on the map - I tried size (of a symbol),
> color and outlinecolor but only outlinecolor works!
>   $old_class->set("size",40);
>   $old_class->set("color",$map->addColor(218,218,218));
>           //DOESN'T WORK??
>   $old_class->set("outlinecolor",$map->addColor(218,218,218));
>           //WORKS!!
>   $layer->draw($img); // draw layer

The code above should work... assuming that you got $old_class using
$layer->getClass().  Perhaps with the whole script we could figure
what's wrong.

> I have Mandrake Linux 7.1 running Mapserver Version (3.3.011)
> PHP version (3.0.13). Thanks in advance!!

Note that there have been several fixes and new members/methods added in
PHP MapScript since version 3.3.011, so it might be a good idea to get a
more recent version... the latest source is quite stable, so it would be
safe to use it.

 Daniel Morissette                morissette at dmsolutions.ca
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.

More information about the mapserver-users mailing list