[mapserver-users] PHP/Mapscript: Creating a "virtual" layer on the fly
Assefa Yewondwossen
assefa at dmsolutions.ca
Fri Feb 15 13:51:41 PST 2002
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