[Mapserver-users] Labeling lines from OGR
Matthew Haines
mhaines94108 at hotmail.com
Wed Jan 21 10:32:27 PST 2004
Frank,
That did the trick, sort of. The problem is that the labels are
streetnames, and in the .map file they have a printing angle on them. That
ensures that the streetname lies inside the whitespace that represents the
street. Thus the tax block and lot map is readable. However, as soon as I
start controlling the style information through MapServer, I lose the angle
and everything just prints horizontally like normal text. The maps become
unreadable.
I've been struggling with these mapinfo streetname files for a while. I get
them from the city planning folks. Is there a good strategy to get some
control over the formatting of the streetnames without losing the angle?
I used ogr2ogr to translate the files into .shp files. Doing so I got the
idea that maybe I could sneak in a font change or "turn on" the streetname
labels and then convert them back to .map files. Is this convoluted or a
good strategy? Ultimately I'd like to have everything inside my PostgreSQL
database, but I can't lose those angles.
Matthew
----- Original Message -----
From: "Frank Warmerdam" <warmerdam at pobox.com>
To: "Matthew Haines" <mhaines94108 at hotmail.com>
Cc: <mapserver-users at lists.gis.umn.edu>
Sent: Wednesday, January 21, 2004 11:41 AM
Subject: Re: [Mapserver-users] Labeling lines from OGR
> Matthew Haines wrote:
> > I have a .tab file which I am currently accessing through OGR. It
> > contains lines like this:
> >
> > OGRFeature(bklion):537
> > Street (String) = FT HAMILTON
> > FromLeft (Integer) = 105
> > ToLeft (Integer) = 107
> > FromRight (Integer) = 106
> > ToRight (Integer) = 110
> > ZipLeft (Integer) = 11209
> > ZipRight (Integer) = 11209
> > Style = PEN(w:1px,c:#c0c0c0,id:"mapinfo-pen-2.ogr-pen-0")
> > LINESTRING (976686.133 162407.387,976203.783 161682.929)
> >
> > When I add them to my .map file as a layer the lines draw nicely.
> > However I can't get the street ('FT HAMILTON' in this example) to draw.
> > What is the minimal stuff I can put in my layer to get these labelled?
> > Below is my current layer. I have tried it with the STYLEITEM removed
> > and also with the LABEL block removed, but no labels.
>
> Matthew,
>
> Daniel might have a more detailed response, but my take on this is that
> the mapinfo file itself does not by default request a rendering of the
> street names. That is, there is no "LABEL" action in the Style string.
> So, the STYLEITEM AUTO will just use the PEN information to draw the line
> properly.
>
> To do the labelling you will likely have to add another LAYER definition
> in your .map file, coming from the same .tab file, but in this one use
> normal MapServer mechanisms to draw labels along the line from the Street
> attribute -- but don't use STYLEITEM AUTO. I am not too up on the
labelling
> stuff, but you should be able to find info in the normal tutorials on
this.
>
> The key think to recognise is that the .tab autostyling information does
not
> include the labels, so it has to be handled in a seperate rendering pass
> (that is ... as an additional layer).
>
> Good luck,
>
> --
> ---------------------------------------+----------------------------------
----
> I set the clouds in motion - turn up | Frank Warmerdam,
warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush | Geospatial Programmer for Rent
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list