[Mapserver-users] Need Urgent Help on PHP/MapScript >> ms_newPointObj()
Merlos
merlos at tsc.uvigo.es
Mon Jul 19 16:34:28 PDT 2004
After making some tests, I think that if you want to create a new layer on
the fly you have to create using mapscript a new style and a new class as
well. On my tests, I removed the style of the INLINE layer and the result was
that it dissapeared on the map image, it seems that there is no default style
and class set.
I'm quite newbie, so maybe a phpmascript guru can corroborate my beliefs
Anywat, why don't you add an empty layer as I did? That way you will save
coding time :-)
Here you have the one I use:
LAYER
NAME "INLINE"
TYPE POINT
STATUS ON
CLASS
NAME "0"
STYLE
COLOR 255 0 0 # red
MAXSIZE 300 # default 50
SYMBOL 'phone'
SIZE 16
END #style
END #class
END #layer
On Monday 19 July 2004 21:55, Ishrar Hussain wrote:
> Dear Merlos,
>
> Thank you very much for your reply.
>
> Seeing your code, the question I now have is that, if
> the "Inline" layer (as you've mentioned) is not
> present in my map file, and I create a point layer
> with ms_newLayerObj(), then do I need to draw() the
> layer before referring its instance while drawing the
> point?
>
> Looking forward to your reply.
> Thanks again.
>
> Regards,
> Ishrar
>
> --- Merlos <merlos at tsc.uvigo.es> wrote:
> > Try this. It works for me.
> >
> > <?php
> >
> > $my_map= ms_newMapObj('data/test2.map');
> >
> > $pt = ms_newPointObj();
> > $pt-> setXY(5,5);
> > $img = $my_map->draw();
> > //Inline is a POINT layer.
> > $layer = $my_map->getLayerByName('INLINE');
> > $pt->draw($my_map, $layer, $img, 0 ,'yuhuu');
> >
> >
> > $url = $img->saveWebImage();
> >
> > echo "<img src=\"$url\" alt=\"Yuhuu!\" />";
> >
> > ?>
> >
> > Regards. Merlos.
> >
> > On Monday 19 July 2004 17:52, Ishrar Hussain wrote:
> > > Please give me an example code showing how to use
> > > PointObj class, i.e. ms_newPointObj(), to
> >
> > dynamically
> >
> > > draw a point over an already created instance of
> > > MapObj, which have been instantiated with a static
> > > .map file.
> > >
> > > Using Maplab, I have created my web mapping
> > > application, which successfully published my shape
> > > files in 4 layers. The map is now static. And over
> > > this map, I need to draw with PHP/MapScript a new
> > > layer that will hold one dynamic point, whose
> > > coordinates I will be retrieving from a database
> >
> > using
> >
> > > PHP. (I am editing the drawmap.php file in the
> >
> > wrapper
> >
> > > folder for this.)
> > >
> > > Note that, I don't want to have this new layer
> > > definition in my map file, which will make the
> >
> > layer
> >
> > > static. I also cannot use any database connection
> >
> > in
> >
> > > the mapfile (postgis or postgre or mygis). Thus,
> > > PHP/MapScript's PointObj is my only choice.
> > >
> > > So, if possible, let me know whether PointObj can
> >
> > be
> >
> > > used to dynamically draw a point like this over a
> > > MapObj, which is already instantiated with a map
> >
> > file
> >
> > > having 4 layer definitions.
> > >
> > > Any detailed example code showing how to use
> >
> > PointObj
> >
> > > will do.
> > > Thank you.
> > >
> > > - Ishrar
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Vote for the stars of Yahoo!'s next ad campaign!
>
> http://advision.webevents.yahoo.com/yahoo/votelifeengine/
>
> > > _______________________________________________
> > > Mapserver-users mailing list
> > > Mapserver-users at lists.gis.umn.edu
>
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
> > --
> > --
> > http://www.merlos.biz
>
> __________________________________
> Do you Yahoo!?
> Vote for the stars of Yahoo!'s next ad campaign!
> http://advision.webevents.yahoo.com/yahoo/votelifeengine/
--
--
http://www.merlos.biz
More information about the MapServer-users
mailing list