[mapserver-users] svg output label anomalies
Barend Köbben
kobben at itc.nl
Wed Feb 17 02:59:40 PST 2010
Hi,
The first anomaly is because you have
COLOR 0 0 255
OUTLINECOLOR 255 255 255
for you labels. The SVG driver mimics a separate stroke and fill color by
having two instances, each in a different color.
Your second anomaly is not clearly descibed. Do you mean the png is NOT
rotated and the SVG is? Or is the SVG one rotated wrongly (cw instead of
ccw), while the png is rotated correctly?
Barend
--
Barend Köbben
Senior Lecturer
ITC University of Twente, Faculty of Geo-Information Science and
Earth Observation
PO Box 6, 7500AA Enschede, The Netherlands
+31 (0)53 4874253
On 16-02-10 23:59, "sbauman at abt.net" <sbauman at abt.net> wrote:
> I'm writing a street mapping application that has two output formats:
> a png file to the web browser and an svg file for further editing and
> printing via inkscape. I'm using a single map file with two output
> formats like this:
>
> OUTPUTFORMAT
> NAME png
> DRIVER "GD/PNG"
> MIMETYPE "image/png"
> IMAGEMODE PC256
> EXTENSION "png"
> END
> OUTPUTFORMAT
> NAME svg
> MIMETYPE "image/svg+xml"
> DRIVER svg
> FORMATOPTION "COMPRESSED_OUTPUT=FALSE"
> FORMATOPTION "FULL_RESOLUTION=TRUE"
> END
>
> The perl script on the web server chooses the output in response to
> what's sent from the browser. If an svg output is desired the perl
> script does the following to generate an svg file:
>
> # draw map and save image
> #
> my $image = $map->draw();
> $map->drawLabelCache($image);
> $image->save($image_path.$image_name);
>
> if ($parms->param('print')) {
> my $print_map = $map->clone();
> $print_map->selectOutputFormat("svg");
> $print_map->{resolution} = 90;
> my $print_image = $print_map->draw();
> $print_map->drawLabelCache($print_image);
> my $filename=$image_path.$print_name;
> $print_image->save($filename);
> open(DLFILE, "<$filename");
> my @fileholder = <DLFILE>;
> close(DLFILE);
> print "Content-Type:application/x-download\n";
> print "Content-Disposition:attachment;filename=nys1.svg\n\n";
> print @fileholder;
> exit;
> }
>
> where $map and $image are generated for the png output. I'm cloning
> this map object and changing some of the attributes that are svg
> specific. The hope is that the svg output would duplicate what
> appears on the screen because what appears on the screen is good for
> my purposes.
>
> There are two anomalies. First, all the labels are printed in
> duplicate. I've verified this by looking at the svg file with a text
> editor. I can live with this one.
>
> The label directive on the map file is:
>
> LABEL
> TYPE truetype
> FONT "arial"
> SIZE 8
> ANGLE auto
> COLOR 0 0 255
> OUTLINECOLOR 255 255 255
> MINDISTANCE 100
> MINFEATURESIZE auto
> POSITION auto
> END
>
> This brings up the second and more serious anomaly. I'm using
> mapserver to align and position the labels close to the line
> features. It does a good job on the png file. However, it does not
> rotate labels in the clockwise direction but keeps them horizontal.
> It's fine for labels that are rotated counter-clockwise. I've
> verified this by reading the svg file. Here are two examples:
>
> <text x="130" y="-1" font-family="arial" font-size="8pt"
> fill="#000000" stroke="#ffffff"
> stroke-width="0.1" text-anchor="middle">
> Main St
> </text>
> <text x="259" y="419" font-family="arial" font-size="8pt"
> fill="#000000" stroke="#ffffff"
> stroke-width="0.1" transform="rotate(-84.995650 259 419)"
> text-anchor="middle">Main St
> </text>
>
> The rotate transform gives the rotation angle and the pivot point.
> That's a counter-clockwise rotation because svg makes the downward
> directon on the y-axis to be positive.
>
> Here's the version string for my installation:
>
> MapServer version 5.4.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
> OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE
> SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER
> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT
> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=THREADS
> SUPPORTS=GEOS SUPPORTS=RGBA_PNG INPUT=TIFF INPUT=POSTGIS INPUT=OGR
> INPUT=GDAL INPUT=MYGIS INPUT=SHAPEFILE
>
> Any help would be appreciated. Thanks.
>
>
> Stephen Bauman
> 13810 Franklin Ave 2N
> Flushing NY 11355-3302
> Tel: 718-359-7972 (USA)
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
Faculty of Geo-Information Science and Earth Observation (ITC)
University of Twente
E-mail disclaimer
The information in this e-mail, including any attachments, is intended for the addressee only. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or action in relation to the content of this information is strictly prohibited. If you have received this e-mail by mistake, please delete the message and any attachment and inform the sender by return e-mail. ITC accepts no liability for any error or omission in the message content or for damage of any kind that may arise as a result of e-mail transmission.
More information about the MapServer-users
mailing list