Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
For completeness in a template you can use the item tag, e.g.: [item name="foo" precision="2"] There is also a commify option to make big numbers look nicer. (e.g. 2,123.23) Steve From: mapserver-users-boun...@lists.osgeo.org [mapserver-users-boun...@lists.osgeo.org] on behalf of Astrid Emde [astrid.e...@wheregroup.com] Sent: Friday, November 23, 2012 4:04 AM To: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes? Am 23.11.2012 10:39, schrieb Lars Lingner: > On 23.11.2012 10:12, Astrid Emde wrote: >> Hello, >> >> I have a shapefile with a column of type double that contains values >> like 2.54 or -2.03. >> >> When I label the geometrie with this column or display this column in >> my infotemplate I get the following notation of the values: >> 2.540e+000 -2.030e+000 >> >> If there a way to tell MapServer to display the "normal" notation of >> the value? Or do I have to change the shape? >> > You can define your own format by using > > ... > CLASS > ... > TEXT (round[numbercolumn], 2) > ... > LABEL > ... > END > END > ... > > In RFC 64 [1] you'll find some informations. > > I'm pretty sure I used it for myself. But grepping through my current > mapfiles say otherwise. So I can't give an working example. > > > Lars > > > [1] http://mapserver.org/development/rfc/ms-rfc-64.html Hi Lars, thanks for the information! It works fine for the label. Before I defined LABELITEM mycolumn and got the long notation: 2.540e+000 with definition TEXT mycolumn the label looks fine (without using any function): 2.54 Is there a solution for the query result too? Astrid ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
On 12-11-23 10:25 AM, Astrid Emde wrote: > Hi Lars, > > again - thanks for your answer. I got a solution. > > CONNECTIONTYPE OGR > CONNECTION "double_test.shp" > DATA "Select *, J_2010_201*1 as newcolumn from double_test" > > The function round(numbercolumn,2) was not found but with multiplication by 1 > it works. > > Astrid Hi Astrid, Sounds like you found a nice item for a new MapServer wiki page in the "Tricks, Tips, and HowTos" section (hint hint) https://github.com/mapserver/mapserver/wiki -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
Am 23.11.2012 14:30, schrieb Lars Lingner: >> Hi Lars, >> >> thanks for the information! >> >> It works fine for the label. >> >> Before I defined LABELITEM mycolumn and got the long notation: >> 2.540e+000 >> >> with definition TEXT mycolumn the label looks fine (without using any >> function): 2.54 >> >> Is there a solution for the query result too? >> > I assume that you cant use any of these functions in your template file. > Would be nice if I'm wrong. > > An workaround could be to use the ogr connection type. This way, you can > access and modify your features/attributes with SQL. > > Look at example #4 here [1]. I think you can use "SELECT ..., > round(numbercolumn,2) as mycolumn FROM..." here. > > But than... if the performance isn't good enough, it might me worth to > just preprocess the shape files. Or put them in a database to be more > flexibel. > > > Lars > > > [1] > http://mapserver.org/input/vector/ogr.html#examples-of-layer-definitions-using-ogr > > Hi Lars, again - thanks for your answer. I got a solution. CONNECTIONTYPE OGR CONNECTION "double_test.shp" DATA "Select *, J_2010_201*1 as newcolumn from double_test" The function round(numbercolumn,2) was not found but with multiplication by 1 it works. Astrid ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
> Hi Lars, > > thanks for the information! > > It works fine for the label. > > Before I defined LABELITEM mycolumn and got the long notation: > 2.540e+000 > > with definition TEXT mycolumn the label looks fine (without using any > function): 2.54 > > Is there a solution for the query result too? > I assume that you cant use any of these functions in your template file. Would be nice if I'm wrong. An workaround could be to use the ogr connection type. This way, you can access and modify your features/attributes with SQL. Look at example #4 here [1]. I think you can use "SELECT ..., round(numbercolumn,2) as mycolumn FROM..." here. But than... if the performance isn't good enough, it might me worth to just preprocess the shape files. Or put them in a database to be more flexibel. Lars [1] http://mapserver.org/input/vector/ogr.html#examples-of-layer-definitions-using-ogr ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
According to http://www.mapserver.org/mapfile/class.html TEXT ("Area is: " + tostring([area],"%.2f")) could also be used. round and tostring are documented in http://www.mapserver.org/mapfile/expressions.html round ( n1 , n2 ) tostring ( n1, "Format1" ) Håvard On 11/23/2012 10:39 AM, Lars Lingner wrote: On 23.11.2012 10:12, Astrid Emde wrote: Hello, I have a shapefile with a column of type double that contains values like 2.54 or -2.03. When I label the geometrie with this column or display this column in my infotemplate I get the following notation of the values: 2.540e+000 -2.030e+000 If there a way to tell MapServer to display the "normal" notation of the value? Or do I have to change the shape? You can define your own format by using ... CLASS ... TEXT (round[numbercolumn], 2) ... LABEL ... END END ... In RFC 64 [1] you'll find some informations. I'm pretty sure I used it for myself. But grepping through my current mapfiles say otherwise. So I can't give an working example. Lars [1] http://mapserver.org/development/rfc/ms-rfc-64.html ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- Håvard Tveite Department of Mathematical Sciences and Technology, UMB Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
Am 23.11.2012 10:39, schrieb Lars Lingner: > On 23.11.2012 10:12, Astrid Emde wrote: >> Hello, >> >> I have a shapefile with a column of type double that contains values >> like 2.54 or -2.03. >> >> When I label the geometrie with this column or display this column in >> my infotemplate I get the following notation of the values: >> 2.540e+000 -2.030e+000 >> >> If there a way to tell MapServer to display the "normal" notation of >> the value? Or do I have to change the shape? >> > You can define your own format by using > > ... > CLASS > ... > TEXT (round[numbercolumn], 2) > ... > LABEL > ... > END > END > ... > > In RFC 64 [1] you'll find some informations. > > I'm pretty sure I used it for myself. But grepping through my current > mapfiles say otherwise. So I can't give an working example. > > > Lars > > > [1] http://mapserver.org/development/rfc/ms-rfc-64.html Hi Lars, thanks for the information! It works fine for the label. Before I defined LABELITEM mycolumn and got the long notation: 2.540e+000 with definition TEXT mycolumn the label looks fine (without using any function): 2.54 Is there a solution for the query result too? Astrid ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
On 23.11.2012 10:12, Astrid Emde wrote: > Hello, > > I have a shapefile with a column of type double that contains values > like 2.54 or -2.03. > > When I label the geometrie with this column or display this column in > my infotemplate I get the following notation of the values: > 2.540e+000 -2.030e+000 > > If there a way to tell MapServer to display the "normal" notation of > the value? Or do I have to change the shape? > You can define your own format by using ... CLASS ... TEXT (round[numbercolumn], 2) ... LABEL ... END END ... In RFC 64 [1] you'll find some informations. I'm pretty sure I used it for myself. But grepping through my current mapfiles say otherwise. So I can't give an working example. Lars [1] http://mapserver.org/development/rfc/ms-rfc-64.html ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] How can I avoid long notation of double values in label or info template for shapes?
Hello, I have a shapefile with a column of type double that contains values like 2.54 or -2.03. When I label the geometrie with this column or display this column in my infotemplate I get the following notation of the values: 2.540e+000 -2.030e+000 If there a way to tell MapServer to display the "normal" notation of the value? Or do I have to change the shape? -- Mit freundlichen Grüßen Astrid Emde Where2B Konferenz 2012 13. Dezember 2012 in Bonn www.where2b-conference.com Astrid Emde WhereGroup GmbH & Co.KG Eifelstraße 7 53119 Bonn Germany Fon: +49(0)228 90 90 38 - 19 Fax: +49(0)228 90 90 38 - 11 astrid.e...@wheregroup.com www.wheregroup.com Folgen Sie der WhereGroup auf twitter: http://twitter.com/WhereGroup_com Amtsgericht Bonn, HRA 6788 --- Komplementärin: WhereGroup Verwaltungs GmbH vertreten durch: Olaf Knopp, Peter Stamm --- pgp-public key: http://pgp.mit.edu:11371/pks/lookup?search=0x06DA52D72D515284 Signierte und/oder verschlüsselte Nachrichten sind sehr willkommen Signed and/or encrypted mail is highly appreciated ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users