[mapserver-users] PHP/Mapscript: Creating a "virtual" layer o n the fly

Doyon, Jean-Francois Jean-Francois.Doyon at ccrs.nrcan.gc.ca
Fri Feb 15 17:04:27 EST 2002


Assefa,

Thanks, but that didn't do it either ...

Do I really have to use a index value for the color? Maybe in that case I
should read the index for that color instead of adding it , since it's
allready in use (There allready is black on the map) ...

I'll play with that, but any other ideas?

Thanks,
J.F.

-----Original Message-----
From: Assefa Yewondwossen [mailto:assefa at dmsolutions.ca]
Sent: Friday, February 15, 2002 4:52 PM
To: Doyon, Jean-Francois
Cc: mapserver
Subject: Re: [mapserver-users] PHP/Mapscript: Creating a "virtual" layer
on the fly


The only thing that I see is that the color setting is not correct. You
should
do something like :

 $colorId = $poMap->addColor(0,0,0);
$class->set("color", $colorId);

hope it helps.



"Doyon, Jean-Francois" wrote:

> Hello ... Me again :)
>
> Now I want to create a lyer to add to a mapfile entirely on the fly, using
> point coordinates provided via the url:
>
> if ( isset($HTTP_GET_VARS['lat']) && isset($HTTP_GET_VARS['long']) ) {
>         $pointobj = ms_newPointObj();
>         $pointobj->setXY($HTTP_GET_VARS['lat'],$HTTP_GET_VARS['long']);
>         $projfrom = ms_newprojectionobj('proj=latlong');
>         $projto =
>
ms_newprojectionobj('proj=lcc,ellps=GRS80,lat_0=49n,lon_0=95w,lat_1=49n,lat_
> 2=77n');
>         $pointobj->project($projfrom,$projto);
>         $lineobj = ms_newLineObj();
>         $lineobj->add($pointobj);
>         $pointobj->free();
>         $shapeobj = ms_newShapeObj(MS_SHAPE_POINT);
>         $shapeobj->add($lineobj);
>         $lineobj->free();
>         $layerobj = ms_newLayerObj($map);
>         $layerobj->set('type',MS_LAYER_POINT);
>         $layerobj->set('status',MS_ON);
>         $layerobj->addFeature($shapeobj);
>         $classobj = ms_newClassObj($layerobj);
>         $classobj->set('symbol',0);
>         $classobj->set('size',20);
>         $classobj->set('color','0 0 0');
> }
>
> This doesn't draw however ... I don't get errors, I just don't see the
> point. a Symbol size 20 should make it visible enough, no ?
>
> I checked the addFeature, and returns 0 (NOT -1), so that works ok ... I
> also checked my projection parameters, and see nothing wrong with them.
>
> I checked the layer index and it says 60, which sounds about right, and
> means that the new layer WAS created on "top", so that shouldn't be the
> problem either ...
>
> Any ideas?
>
> Thanks,
>
> Jean-François Doyon
> Internet Service Development and Systems Support
> GeoAccess Division
> Canadian Center for Remote Sensing
> Natural Resources Canada
> http://atlas.gc.ca
> Phone: (613) 992-4902
> Fax: (613) 947-2410

--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst

Email: assefa at dmsolutions.ca
http://www.dmsolutions.ca/

Phone: (613) 565-5056
Fax:   (613) 565-0925
----------------------------------------------------------------




More information about the mapserver-users mailing list