[Geoserver-users] Using functions in Textsymbolizer / Running 1.4 as windoze-service

Hi out there,

sorry i'm so boring...

I'm wondering if it is possible in the textsymbolizer to format the output
other than font, color, ...

I can't find examples where a returned float was rounded (49.992232398 to
49.99) or append something (let's say the Currency-Symbol before or after
the value.

I tried (featuretype is from postgresql)

<TextSymbolizer>
<Label>
<ogc:PropertyName>round(temp_mean_okt, 2 )</ogc:PropertyName>
</Label>
...

with no luck. After thinking of that, i see i missed that Geoserver uses
other datasources like shapefiles,which can't of course do this thing i
requested.

But then there must be another way to archive this, hidden to me.

Oh, and how about running 1.4. as Windows-Service? I've tried these
wrapper.exe, changing some paths to the new directory-layout, but is won't
run (something with spring is all i can see). In the near future i would
like to use Geoserver as mapserver on a real internet-server, but that
requires running Geoserver as serviice.

Regards,
              Frank

--
View this message in context: http://www.nabble.com/Using-functions-in-Textsymbolizer---Running-1.4-as-windoze-service-tf2588682.html#a7218162
Sent from the GeoServer - User mailing list archive at Nabble.com.

The windows service is still in testing. I have it working on my machine on the recent 1.4.0-RC3 release (coming out today).
The old wrapper code from 1.3.x does not work with 1.4, so you will need the newer version.

As for text symbolizers, I think one should be able to append text fields with their own characters, but I don't think that can be done in geoserver. Can anyone else remember?
It wouldn't be hard to implement if it isn't in there.
As for rounding, it would be possible to do, but I'm fairly certain there is no way to do that now. Obviously this would be a good feature to add in.

If you could go to our issue tracker Jira (http://jira.codehaus.org/browse/GEOS?report=com.atlassian.jira.plugin.system.project:roadmap-panel) and 'Create a new Issue', for this item then we will get to it quicker (well, we won't forget about it). Schedule it for version 1.5.
If Jira is giving you grief, I can add the task for you, just message me.

Brent Owens
(The Open Planning Project)

dfd wrote:

Hi out there,

sorry i'm so boring...

I'm wondering if it is possible in the textsymbolizer to format the output
other than font, color, ...

I can't find examples where a returned float was rounded (49.992232398 to
49.99) or append something (let's say the Currency-Symbol before or after
the value.

I tried (featuretype is from postgresql)

<TextSymbolizer>
<Label>
<ogc:PropertyName>round(temp_mean_okt, 2 )</ogc:PropertyName>
</Label>
...

with no luck. After thinking of that, i see i missed that Geoserver uses
other datasources like shapefiles,which can't of course do this thing i
requested.

But then there must be another way to archive this, hidden to me.

Oh, and how about running 1.4. as Windows-Service? I've tried these
wrapper.exe, changing some paths to the new directory-layout, but is won't
run (something with spring is all i can see). In the near future i would
like to use Geoserver as mapserver on a real internet-server, but that
requires running Geoserver as serviice.

Regards,
              Frank

Brent,

Brent Owens schrieb am 08.11.2006 18:04:

The windows service is still in testing. I have it working on my machine on the recent 1.4.0-RC3 release (coming out today).
The old wrapper code from 1.3.x does not work with 1.4, so you will need the newer version.

Good news. :slight_smile: Hopefully it would be plug'n'play... Is it included in RC3?

As for text symbolizers, I think one should be able to append text fields with their own characters, but I don't think that can be done in geoserver. Can anyone else remember?
It wouldn't be hard to implement if it isn't in there.
As for rounding, it would be possible to do, but I'm fairly certain there is no way to do that now. Obviously this would be a good feature to add in.

What i've forgotten, PostGreSQL has views, with them my problems could be archieved. This i've done today and it came out really nice.
AFAIK SLD's are standardisized, and when it's not in there, there is no need to break the standard. When the standard could be enhanced itself, then it would really be a nice to have.

Another issue is, that Googlemaps relies on "tiles" 256px x 256px to make the map, which causes the textsymbolizer to render the text more than visible needed (ie. when the viewpoint is europe and some countries are "split" in respect of the tiles, the countryname could be renders once, doubled or more).

From Geoserver's view this is correct behaviour, seeing the boundingbox. On the other hand, when user wishes to put the textsymbolizer at the "center of the geometry", Geoserver should take the geometry as a whole and then render it, if inside the boundingbox or not, if outside.
I'm not shure what the right way is. There lacks the standard, there should be a parameter like <render>always || respect || move</render> (always: like now, respect: dont render if outside, move: move inside, when outside), which would be a good way.

Best regards,

    Frank

Frank,

I've had a lot of luck installing Tomcat on a windows server as a service, and then running geoserver as a war-file webapp within tomcat.

Tomcat has been running as a windows service for years, and the latest versions have great support for setting up all the java environment variables you could need.

--saul

Oh, and how about running 1.4. as Windows-Service? I've tried these
wrapper.exe, changing some paths to the new directory-layout, but is won't
run (something with spring is all i can see). In the near future i would
like to use Geoserver as mapserver on a real internet-server, but that
requires running Geoserver as serviice.

Regards,
              Frank

Saul,

see Bent's anwer to me.

Psst: I'm proud i got Geoserver running here out of the box for test and playing. These whole java-things are nothing for old man like me.

Thanks anyway for answering.

Best regards,

    Frank

Saul Farber schrieb am 08.11.2006 20:53:

Frank,

I've had a lot of luck installing Tomcat on a windows server as a service, and then running geoserver as a war-file webapp within tomcat.

Tomcat has been running as a windows service for years, and the latest versions have great support for setting up all the java environment variables you could need.

--saul

Actually there is talk about standardizing tiling, so servers like GeoServer and MapServer can know that a tile is being requested, and render the image accordingly. It is definitely something that we are all looking forward to so we can make our tiled maps look nicer and perform even faster.
As for a time frame, I'm not sure when anything will be decided upon. Can anyone else on the list who is in the loop give us an update?

Brent Owens
(The Open Planning Project)

Frank Durstewitz wrote:

Brent,

Brent Owens schrieb am 08.11.2006 18:04:

The windows service is still in testing. I have it working on my machine on the recent 1.4.0-RC3 release (coming out today).
The old wrapper code from 1.3.x does not work with 1.4, so you will need the newer version.

Good news. :slight_smile: Hopefully it would be plug'n'play... Is it included in RC3?

As for text symbolizers, I think one should be able to append text fields with their own characters, but I don't think that can be done in geoserver. Can anyone else remember?
It wouldn't be hard to implement if it isn't in there.
As for rounding, it would be possible to do, but I'm fairly certain there is no way to do that now. Obviously this would be a good feature to add in.

What i've forgotten, PostGreSQL has views, with them my problems could be archieved. This i've done today and it came out really nice.
AFAIK SLD's are standardisized, and when it's not in there, there is no need to break the standard. When the standard could be enhanced itself, then it would really be a nice to have.

Another issue is, that Googlemaps relies on "tiles" 256px x 256px to make the map, which causes the textsymbolizer to render the text more than visible needed (ie. when the viewpoint is europe and some countries are "split" in respect of the tiles, the countryname could be renders once, doubled or more).

From Geoserver's view this is correct behaviour, seeing the boundingbox. On the other hand, when user wishes to put the textsymbolizer at the "center of the geometry", Geoserver should take the geometry as a whole and then render it, if inside the boundingbox or not, if outside.
I'm not shure what the right way is. There lacks the standard, there should be a parameter like <render>always || respect || move</render> (always: like now, respect: dont render if outside, move: move inside, when outside), which would be a good way.

Best regards,

   Frank

---
avast! Antivirus auf durstewitz.biz: Ausgehende Nachricht virenfrei.
Getestet am: 08.11.2006 20:47:16
Virus-Datenbank (VPS): 0646-2, 07.11.2006

oops, I forgot to tell you about the GeoServer service option. It is standard in the windows installer version of GeoServer RC3.
The instructions come along with it. But if you have issues just fire us off a message.

Brent Owens
(The Open Planning Project)

Frank Durstewitz wrote:

Brent,

Brent Owens schrieb am 08.11.2006 18:04:

The windows service is still in testing. I have it working on my machine on the recent 1.4.0-RC3 release (coming out today).
The old wrapper code from 1.3.x does not work with 1.4, so you will need the newer version.

Good news. :slight_smile: Hopefully it would be plug'n'play... Is it included in RC3?

As for text symbolizers, I think one should be able to append text fields with their own characters, but I don't think that can be done in geoserver. Can anyone else remember?
It wouldn't be hard to implement if it isn't in there.
As for rounding, it would be possible to do, but I'm fairly certain there is no way to do that now. Obviously this would be a good feature to add in.

What i've forgotten, PostGreSQL has views, with them my problems could be archieved. This i've done today and it came out really nice.
AFAIK SLD's are standardisized, and when it's not in there, there is no need to break the standard. When the standard could be enhanced itself, then it would really be a nice to have.

Another issue is, that Googlemaps relies on "tiles" 256px x 256px to make the map, which causes the textsymbolizer to render the text more than visible needed (ie. when the viewpoint is europe and some countries are "split" in respect of the tiles, the countryname could be renders once, doubled or more).

From Geoserver's view this is correct behaviour, seeing the boundingbox. On the other hand, when user wishes to put the textsymbolizer at the "center of the geometry", Geoserver should take the geometry as a whole and then render it, if inside the boundingbox or not, if outside.
I'm not shure what the right way is. There lacks the standard, there should be a parameter like <render>always || respect || move</render> (always: like now, respect: dont render if outside, move: move inside, when outside), which would be a good way.

Best regards,

   Frank

---
avast! Antivirus auf durstewitz.biz: Ausgehende Nachricht virenfrei.
Getestet am: 08.11.2006 20:47:16
Virus-Datenbank (VPS): 0646-2, 07.11.2006

Frank Durstewitz ha scritto:

Brent,

Another issue is, that Googlemaps relies on "tiles" 256px x 256px to make the map, which causes the textsymbolizer to render the text more than visible needed (ie. when the viewpoint is europe and some countries are "split" in respect of the tiles, the countryname could be renders once, doubled or more).

From Geoserver's view this is correct behaviour, seeing the boundingbox. On the other hand, when user wishes to put the textsymbolizer at the "center of the geometry", Geoserver should take the geometry as a whole and then render it, if inside the boundingbox or not, if outside.

The problem is going to be managed properly when we implement the
tiling service spec (http://wiki.osgeo.org/index.php/Tile_Map_Service_Specification).
Basically we need to modify the renderer not to do smart label placement, but that's not the full story, it also have to renderer an
area bigger than the tile to make sure label that span tiles are rendered completely, the same goes for line width and point symbolizers
that happen to fall on a tile edge.

All in all, this requires some time so it's not going to land in 1.4.0,
which is in deep freeze now, but it may land on geoserver by 1.6.0 or 1.5.0 depending on priorities (which are driven by users requests, so
if you need this, speak up :slight_smile:

Cheers
Andrea

dfd ha scritto:

Hi out there,

sorry i'm so boring...

I'm wondering if it is possible in the textsymbolizer to format the output
other than font, color, ...

I can't find examples where a returned float was rounded (49.992232398 to
49.99) or append something (let's say the Currency-Symbol before or after
the value.

I tried (featuretype is from postgresql)

<TextSymbolizer>
<Label>
<ogc:PropertyName>round(temp_mean_okt, 2 )</ogc:PropertyName>
</Label>
...

with no luck. After thinking of that, i see i missed that Geoserver uses
other datasources like shapefiles,which can't of course do this thing i
requested.

Well, that's not exactly so. In fact, sld expressions are evaluated in memory, not in the database, and we happen to have quite a complete set of functions that do perform rounding, string concatenation and the like, only they are not documented at all :frowning:
The best list of functions I can give you is the javadoc of the associated classes here:
http://javadoc.geotools.fr/2.2/org/geotools/filter/function/package-summary.html
http://javadoc.geotools.fr/2.2/org/geotools/filter/function/math/package-summary.html

The SLD standard does not define many standard functions as far as I know, but someone did implement a lot of them in geotools (this is one
of the parts where SLD allows custom extensions by implementors).

Anyways, I guess the following is an example along the lines of what
you're looking for (I just did not rounded at the second digit, which you can do by multiplying by 100, rounding and dividing by 100).
Oh, multiply and divide are not functions, they are part of the SLD standard.

<sld:Label>
           <ogc:Function name="strConcat">
             <ogc:Function name="roundDouble">
               <ogc:PropertyName>parcelValue</ogc:PropertyName>
             </ogc:Function>
             <ogc:Literal> $</ogc:Literal>
           </ogc:Function>
         </sld:Label>

Hope this helps
Best regards
Andrea Aime

Andrea,

if i could vote, i say: Thumbs up.

This could be an issue, as GMaps is becomming very popular and could be nicely used with Geoserver.

Best regards,

    Frank

Andrea Aime schrieb am 09.11.2006 14:17:

tiling service spec (http://wiki.osgeo.org/index.php/Tile_Map_Service_Specification).
Basically we need to modify the renderer not to do smart label placement, but that's not the full story, it also have to renderer an
area bigger than the tile to make sure label that span tiles are rendered completely, the same goes for line width and point symbolizers
that happen to fall on a tile edge.

All in all, this requires some time so it's not going to land in 1.4.0,
which is in deep freeze now, but it may land on geoserver by 1.6.0 or 1.5.0 depending on priorities (which are driven by users requests, so
if you need this, speak up :slight_smile:

Cheers
Andrea

Andrea,

thanks for the example and the links. Very usefull (i think, i'll have to go thrue the javadocs)

Best regards,

    Frank

Andrea Aime schrieb am 09.11.2006 14:43:

Well, that's not exactly so. In fact, sld expressions are evaluated in memory, not in the database, and we happen to have quite a complete set of functions that do perform rounding, string concatenation and the like, only they are not documented at all :frowning:
The best list of functions I can give you is the javadoc of the associated classes here:
http://javadoc.geotools.fr/2.2/org/geotools/filter/function/package-summary.html

http://javadoc.geotools.fr/2.2/org/geotools/filter/function/math/package-summary.html

The SLD standard does not define many standard functions as far as I know, but someone did implement a lot of them in geotools (this is one
of the parts where SLD allows custom extensions by implementors).

Anyways, I guess the following is an example along the lines of what
you're looking for (I just did not rounded at the second digit, which you can do by multiplying by 100, rounding and dividing by 100).
Oh, multiply and divide are not functions, they are part of the SLD standard.

<sld:Label>
          <ogc:Function name="strConcat">
            <ogc:Function name="roundDouble">
              <ogc:PropertyName>parcelValue</ogc:PropertyName>
            </ogc:Function>
            <ogc:Literal> $</ogc:Literal>
          </ogc:Function>
        </sld:Label>

Hope this helps
Best regards
Andrea Aime

Andrea Aime escreveu:

All in all, this requires some time so it's not going to land in 1.4.0,
which is in deep freeze now, but it may land on geoserver by 1.6.0 or 1.5.0 depending on priorities (which are driven by users requests, so
if you need this, speak up :slight_smile:

Cheers
Andrea

This is one more user request. :slight_smile:

Regards,
Eduardo