[mapserver-users] LABEL-formatting options
Stephan Holl
stephan.holl at intevation.de
Wed Mar 10 00:30:51 PST 2010
Hello Brent,
pcreso at pcreso.com, [20100310 - 00:25:21]
> Yep, always frustrating to suffer such constraints.
>
> Can you not define the layer in mapserver as an ogr layer rather than
> a native shapefile, and use ogr's pseudo-sql to cast/retrieve the
> value as a numeric more suitable for labeling with?
>
> http://www.gdal.org/ogr/ogr_sql.html
>
> Then in your mapfile use connectiontype ogr, as in:
> http://mapserver.org/input/vector/ogr.html
>
> (see example 4 with shapefiles joined in an ogr query)
I have seen this example, but have not done any experiences in a
productive env. Can you say anything about performance for this sort of
ogr-layer? Is this comparable to shapefiles?
> I agree it would be nice to have mapserver able to do this, but until
> then there should be some workaround (like this) that will suffice.
yes, sure. I guess it will be only some more lines of java-code to add
another column with trim()ed values to the shape, but a generic
solution will be even better.
Cheers
Stephan
> --- On Wed, 3/10/10, Stephan Holl <stephan.holl at intevation.de> wrote:
>
> > From: Stephan Holl <stephan.holl at intevation.de>
> > Subject: Re: [mapserver-users] LABEL-formatting options
> > To: pcreso at pcreso.com
> > Cc: mapserver-users at lists.osgeo.org
> > Date: Wednesday, March 10, 2010, 9:09 PM
> > Hello Brent,
> >
> > pcreso at pcreso.com,
> > [20100309 - 23:49:56]
> >
> > > Hi Stephan,
> > >
> > > Can you not add an appropriate column automatically as
> > the shapefile
> > > is generated?
> > >
> > > Tools such as dbfscript (http://www.whitetown.com/dbf-script/) or
> > > perhaps script something with the shapelib libraries
> > or tools or the
> > > ogr tools?
> >
> > Yes, it is possible.
> >
> > But: I think it is a feature which mapserver should deal
> > with.
> >
> > >
> > > I have found that using Postgis rather than shapefiles
> > gives you the
> > > ability to easily manage such issues as the data
> > retrieved by
> > > mapserver is derived from an SQL query which allows
> > the creation of
> > > virtual "columns" for labels on the fly.
> >
> > In our case we do not have a chance to use any DB at all,
> > since the
> > infrastructure permits it. The data are retrieved from
> > caclculations,
> > which are itself done on a (remote) server.
> >
> > >
> > > Treating this sort of problem as a data management
> > problem, in terms
> > > of supplying the desired data derived on the fly from
> > the stored
> > > data, allows a tool such a Postgis to do what a
> > database is designed
> > > for. A script using shp2pgsql or ogr2ogr to
> > automatically turn your
> > > shapefile into a Postgis table, and render this using
> > mapserver
> > > instead of the shapefile should fix your problem.
> >
> > As said, the specific infrastructure (sadly) does not allow
> > to use
> > PostGIS and the like (yet)....
> > I am after a more general approach (in
> > order to make MapServer a little better), for my usecase it
> > is easy to
> > add a 'display'-column with the right decimal values
> > trimmed.
> >
> > Cheers
> >
> > Stephan
> >
> > > > On Behalf Of Stephan Holl [stephan.holl at intevation.de]
> > > > Sent: Tuesday, March 09, 2010 7:54 AM
> > > > To: mapserver-users at lists.osgeo.org
> > > > Subject: [mapserver-users] LABEL-formatting
> > options
> > > >
> > > > Hello mapservers,
> > > >
> > > > we are using MapServer for visualizing shapefiles
> > with
> > > > double entries
> > > > inside.
> > > >
> > > > Mainly this are contour-lines from waterdepth.
> > The double
> > > > values have
> > > > 32 decimal places and mapserver tries to render
> > them _all_
> > > > along a
> > > > contourline.
> > > > This does not look nice...
> > > >
> > > > Is there an option to trim the values with a
> > dedicated
> > > > mapfile-parameter, e.g. where a prinft-syntax can
> > be used
> > > > to format the
> > > > values?
> > > >
> > > > The shapefiles are generated automatically so
> > adding
> > > > another column with
> > > > trunc()ed or round()ed values is no option.
> > > >
> > > > Are there any options to format
> > label-values/strings? I
> > > > have not found
> > > > anything in the docs.
> > > >
> > > > TIA
> > > >
> > > > Stephan
> > > >
> > > > --
> > > > Stephan Holl <stephan.holl at intevation.de>
> > > > | Tel.: +49 (0)541-33 508 3663
> > > > Intevation GmbH, Neuer Graben 17, 49074 OS |
> > AG
> > > > Osnabrück - HR B 18998
> > > > Geschäftsführer: Frank Koormann, Bernhard
> > Reiter,
> > > > Dr. Jan-Oliver Wagner
> > > > _______________________________________________
> > > > mapserver-users mailing list
> > > > mapserver-users at lists.osgeo.org
> > > > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> > > >
> >
> >
> > --
> > Stephan Holl <stephan.holl at intevation.de>
> > | Tel.: +49 (0)541-33 508 3663
> > Intevation GmbH, Neuer Graben 17, 49074 OS | AG
> > Osnabrück - HR B 18998
> > Geschäftsführer: Frank Koormann, Bernhard Reiter,
> > Dr. Jan-Oliver Wagner
> >
--
Stephan Holl <stephan.holl at intevation.de> | Tel.: +49 (0)541-33 508 3663
Intevation GmbH, Neuer Graben 17, 49074 OS | AG Osnabrück - HR B 18998
Geschäftsführer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100310/a7664e68/attachment.sig>
More information about the MapServer-users
mailing list