[Mapserver-users] point shape layer style and dynamic point data query
Norbert Thieme
norbert.thieme at ilmenau.baw.de
Tue Jun 15 05:31:34 PDT 2004
Sébastien DUBOIS schrieb:
> well i try to display a shape file put in a database postgresql with
> shp2pgsql.....
>
> i suceed in, but i don't understand how to change the style of the output.
> yet the points of my database layer can be displayed by their position in text
> POINT (X,Y) with $label->set("position",MS_CC);
> But if i don't put this line my points are only dispayed by one pixel.
> i can't change the size or put a symbol like a star!!
>
>
> this is one part of the code i use
>
> -------------------------
> $map = ms_newMapObj($Nom_Mapfile);
>
> $map->setextent($xmin,$ymin,$xmax,$ymax);
>
> $map->web->set("imagepath",$mapserver_imagepath);
>
> $map->web->set("imageurl",$mapserver_imageurl);
>
> $map->set("width",$longueur_image_mapfile);
>
> $map->set("height",$hauteur_image_mapfile);
>
>
> $layer = ms_newLayerObj($map);
>
>
> $layer->set("name",$base_de_donnees);
>
> $layer->set("status",MS_DEFAULT);
>
> $layer->set("connectiontype",MS_POSTGIS);
>
> $layer->set("connection","user=".$utilisateur."
> dbname=".$base_de_donnees." host=".$hote);
>
> $layer->set("data",$colonne_geometrique." from ".$table_choisie." as
> foo
> using unique geometry_columns.srid using SRID=-1");
>
>
> $layer->set("type",$type_donnee_geometrique_pour_mapserver);
>
>
> $layer->set("labelitem",$mapserver_labelitem);
>
> $class = ms_newClassObj($layer);
>
> $label = $class->label;
>
> $label->set("position",MS_CC);
>
> $label->color->setRGB(0,0,0);
>
> $label->outlinecolor->setRGB(255,0,0);
>
> $label->shadowcolor->setRGB(255,255,255);
>
> $label->backgroundcolor->setRGB(0,0,255);
>
> $label->backgroundshadowcolor->setRGB(255,255,255);
>
>
>
> $style = ms_newStyleObj($class);
>
>
> $style->set("size",4);
>
> $style->outlinecolor->setRGB(128,0,0);
>
>
> $image = $map->draw();
>
> $image_url = $image->saveWebImage(MS_PNG,1,1,0);
>
> ----------------------
>
>
> I try also to put a symbol in my .map and define the layer as i used to without
> phpmapscript but i doesn't work.
>
> Is there someone who can explain me how to proceed.
> how create $symbole in phpmapscript.
> Perhaps i need to create a point object??
>
> thanks in advance
>
>
> OTHER QUESTION is there someone here who suceed in writing a dynamic point data
> query in phpmapscript? i saw old post but no example of drawing a box without
> jbox and change the color of the point selected and then display the attributes
> of the selected points....
>
>
>
>
>
>
Hi.
I also have such a problem with the size item of the styleobj. I created
a symbol 'circle' (like in the mapfile reference) and add it to my
'template' mapfile (containing the stuff I often use). When I add my
point layer to this map and apply it to my new style with a specific
size then my points are displayed the right size.
The way I see in mapscript is to create a symbolsetfile (texteditor?)
and set the symbols to the mapobj from this file. In the normal mapfile
you can have the symbols and the symbolsetfile under the mapobj but in
the mapscript mapobj you only can have the symbolsetfile.
Perhaps there is another way with SLD but I never worked with that yet.
Regards,
Norbert
More information about the MapServer-users
mailing list