[mapserver-users] Rectangle and Line
Antti J. Lind
anttij.lind at birdlife.fi
Tue Feb 23 21:45:10 PST 2016
Hello,
Just a small changes and I got it working. Now I can draw rectangles,
maybe better way to do, but this seems also work.
map-file:
LAYER
NAME "boxes"
STATUS OFF
TYPE LINE
CLASS
STYLE
COLOR 255 0 127
END
END
END
php-file:
$featlayer = $map->getLayerByName("boxes");
$drawing = ms_newShapeObj(MS_SHAPE_LINE);
$lineObject = ms_newLineObj();
$a = $_point['0'];
$b = $_point['1'];
$c = $_point['2'];
$d = $_point['3'];
$lineObject->addXY($b,$a);
$lineObject->addXY($b,$c);
$lineObject->addXY($d,$c);
$lineObject->addXY($d,$a);
$lineObject->addXY($b,$a);
$drawing->add($lineObject);
$featlayer->addFeature($drawing);
$featlayer->set("status", 1);
--
AJL
Hi,
Same as before, but now without points - totally blank map.
--
AJL
Lime, Steve D (MNIT) kirjoitti 2016-02-18 00:44:
> What happens if you ditch the SYMBOL and SIZE from the style
> definition?
>
> -----Original Message-----
> From: mapserver-users [mailto:mapserver-users-bounces at lists.osgeo.org]
> On Behalf Of Antti J. Lind
> Sent: Wednesday, February 17, 2016 11:59 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Rectangle and Line
>
> Hi,
>
> I try to add rectangle and line on map, but there has not been any
> success. I just can add points on map.
>
> My Mapfile's layer show like this:
> LAYER
> NAME "boxes"
> STATUS OFF
> TYPE POINT
> CLASS
> STYLE
> SYMBOL "circle"
> SIZE 5
> COLOR 0 255 0
> OUTLINECOLOR 0 0 0
> END
> END
> END
>
> And I can add points to map with php mapscript as:
>
> $featlayer = $map->getLayerByName("boxes");
> $drawing = ms_newShapeObj(MS_SHAPE_POLYGON);
> $lineObject = ms_newLineObj();
> $a = $_point['0'];
> $b = $_point['1'];
> $c = $_point['2'];
> $d = $_point['3'];
> $lineObject->addXY($b, $a);
> $lineObject->addXY($d, $c);
> $drawing->add($lineObject);
> $featlayer->addFeature($drawing);
> $featlayer->set("status", 1);
>
> If I change TYPE to LINE, just poists disappear.
>
> Mapserver show points on map ok. But how to draw a line between points
> or rectangle , with same limits?
>
> --
> Antti J. Lind
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
More information about the MapServer-users
mailing list