Hi Harald,

Check out the part

<AnchorPoint>

          <AnchorPointX>0.0</AnchorPointX>

          <AnchorPointY>0.0</AnchorPointY>
</AnchorPoint>

If you adjust the value to 0.5, it will take the centre of the text instead.

Kind regards,

Edward

From: [email protected]
To: [email protected]
Date: Wed, 24 Oct 2012 11:15:54 +0200
Subject: [Geoserver-users] Hello to the list and first question about label     
rotation









Hi folks
 
Being new, first I want to greet everyone on the list. English ain’t my mother 
tongue so I hope you are patient with me
J
 
I am Harry and am working for the IT of a public company in Austria. We are 
mainly working with Intergraph software, managing data in many different 
formats. But I am always trying to keep an open mind towards
 the open source world.
 
At the moment I am trying to build an alternative infrastructure consisting a 
PostGIS database and a Geoserver. I use FME to migrate some data (for testing) 
into the PostGIS database.
Then I try to create WMS, WFS and later WMTS services via Geoserver.
 
The process goes quite well, with the usual bumps and hickups.
Now I am running into a problem with labeling.
My data contains textobjects, being saved as points, having a text and a 
rotation angle written into an attribute.
The problem is the rotation of the text. The rotation angle saved in the 
attribute ORIENTATION is the exact angle of the Text as it was created in 
GeoMedia. There, 0° is East and the rotation is counter clockwise.
 This kind of rotation works in Autodesk products and even in Quantum GIS. 
Sadly, Geoserver goes a different way and has 0° in the North, rotating 
clockwise.
With the help of my sister (she is a math teacher, yea, that helps :D ) I found 
the right algorithm for translating the degrees:
For angles between 0 to 90 degrees: y = 180 – (x + 90)
For all the other angles: y = 180 – (x + 90) + 360
X being the original geomedia-angle stored in the field „ORIENTATION“, Y being 
the translated angle for GeoServer, which I stored in a field „GSROTATION“. No 
problems for FME, using AttributeFieldMapper and
 ExpressionEvaluator.
 
The numbers in PostGIS check out. I then created a style file which looks as 
follows:
 
<?xml version="1.0" encoding="UTF-8"?>

<StyledLayerDescriptor
version="1.0.0"
xmlns="http://www.opengis.net/sld";
xmlns:ogc="http://www.opengis.net/ogc";

  xmlns:xlink="http://www.w3.org/1999/xlink";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

  xsi:schemaLocation="http://www.opengis.net/sld 
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>

  <NamedLayer>

    <Name>Strassenbahnbeschriftung</Name>

    <UserStyle>

      <Name>Strassenbahnbeschriftung</Name>

      <FeatureTypeStyle>

        <Rule>

          <Name>Single symbol</Name>

          <!-- MaxScaleDenominator>5000</MaxScaleDenominator -->

          <PointSymbolizer>

            <Graphic>

              <Mark>

                <WellKnownName>circle</WellKnownName>

              </Mark>

              <Size>0</Size>

            </Graphic>

          </PointSymbolizer>

          <TextSymbolizer>

            <Label>

              <ogc:PropertyName>textstring</ogc:PropertyName>

            </Label>

            <Font>

              <CssParameter
name="font-family">Arial</CssParameter>

              <CssParameter
name="font-size">12</CssParameter>

              <CssParameter
name="font-style">normal</CssParameter>

              <CssParameter
name="font-weight">bold</CssParameter>

            </Font>

            <LabelPlacement>

              <PointPlacement>

                <AnchorPoint>

                  <AnchorPointX>0.0</AnchorPointX>

                  <AnchorPointY>0.0</AnchorPointY>

                </AnchorPoint>

                <Displacement>

                  <DisplacementX>0</DisplacementX>

                  <DisplacementY>0</DisplacementY>

                </Displacement>

                <Rotation>

                  <ogc:PropertyName>gsrotation</ogc:PropertyName>

                </Rotation>  

              </PointPlacement>

            </LabelPlacement>

            <Fill>

              <CssParameter
name="fill">#781760</CssParameter>

            </Fill>

          </TextSymbolizer>

        </Rule>

      </FeatureTypeStyle>

    </UserStyle>

  </NamedLayer>

</StyledLayerDescriptor>
 
The style is valid, I can add it to the layer and can preview the Layer in 
Geoserver. Sadly, the orientation of the text is all wrong.
 
I tried a few things, compared the results to the original data and it seems, 
that instead of rotating around the center of the text, the whole thing rotates 
around some of the corner points of the MBR of
 the text or so. The beaviour is very strange, to say the least…
 
So after much testing (and coursing) I decided to ask the community. I 
sincerely hope you can help me.
TIA for any hints.
Regards,
Harry
 
 
 
Freundliche Grüße
 
Harald Budschedl
Geodaten Management (Geo)

 
IKT Linz GmbH

Ein Unternehmen der Stadt Linz
 
4040 Linz, Hauptstraße 1-5
AUSTRIA
 
Tel.     +43 732 7070 4787
Fax      +43 732 7070 54 4787
visit           
www.linz.at/ikt 
mailto: [email protected]
 
 




Diese Nachricht inklusive aller Anhänge kann vertrauliche Informationen 
enthalten. Sie ist ausschließlich für die adressierten Personen bestimmt. Das 
unerlaubte Kopieren sowie die unbefugte Weitergabe sind nicht gestattet.
 Sollten Sie nicht die richtige Adressatin/der richtige Adressat sein, 
vernichten Sie den gesamten Inhalt (§ 93 Abs. 4 Telekommunikationsgesetz 2003) 
und informieren Sie bitte sofort den/die Absender/in. Nähere Regelungen zur 
elektronischen Kommunikation mit
 der Stadt Linz finden Sie in den "Allgemeinen Hinweisen und 
Nutzungsbestimmungen betreffend das E-Government der Stadt Linz (e-linz)" ( 
http://www.linz.at/images/AGB_egov_2008.pdf )



IKT Linz GmbH, Firmenbuch des Landesgerichtes Linz ++ Firmenbuch-Nummer: 
321197z ++ UID-Nummer: ATU64636344

IKT Linz Infrastruktur GmbH, Firmenbuch des Landesgerichtes Linz ++ 
Firmenbuch-Nummer: 321990s ++ UID-Nummer: ATU64664303

A-4020 Linz, Gruberstraße 42, Tel. +43 732 7070 0, Fax: +43 732 7070 4704, 
[email protected], www.linz.at/ikt





------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users                    
                  
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to