Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label style offset, geomtransform labelpoly, symbolscaledenom #4015

Closed
mapserver-bot opened this issue Apr 4, 2012 · 8 comments
Closed

label style offset, geomtransform labelpoly, symbolscaledenom #4015

mapserver-bot opened this issue Apr 4, 2012 · 8 comments
Assignees
Milestone

Comments

@mapserver-bot
Copy link

Reporter: havatv
Date: 2011/09/10 - 10:03
Trac URL: http://trac.osgeo.org/mapserver/ticket/4015
I have discovered that LABEL STYLE OFFSET, at least when used with GEOMTRANSFORM 'labelpoly' does not work as expected when SYMBOLSCALEDENOM is specified for the layer. If someone is interested in testing, use shp2img with the following map file (FONTSET will probably have to be changed). If SYMBOLSCALEDENOM is commented out, behaviour is as expected. When SYMBOLSCALEDENOM is in effect, the offset will be scaled. Documentation says that OFFSET is given in pixels.

MAP
  SIZE 200 200
  EXTENT 0 0 100 100
  UNITS meters
  IMAGETYPE png

  FONTSET /usr/share/fonts/truetype/font.list

  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS 1 1 END
  END

  LAYER
    NAME "feature"
    STATUS DEFAULT
    TYPE POINT
    SYMBOLSCALEDENOM 25000
    FEATURE
      TEXT "Label"
      POINTS
        50 50
      END
    END
    CLASS
      STYLE # black filled circle
        SYMBOL 'circle'
        MINSIZE 4
        SIZE 4
        MAXSIZE 4
        COLOR 0 0 0
      END
      LABEL
        STYLE # ------ Gray Box (shadow) ------
            GEOMTRANSFORM labelpoly
            COLOR 102 102 102
            OFFSET 2 2
        END
        STYLE # ------ Red Box ------
            GEOMTRANSFORM labelpoly
            COLOR 255 0 0
        END
        FONT "arial"
        TYPE TRUETYPE
        POSITION UR
        MINSIZE 12
        SIZE 12
        MAXSIZE 12
        COLOR 0 0 0
      END
    END
  END # point
END # Map file

I have tested with 6.0 and trunk.

See the attached files.

@mapserver-bot
Copy link
Author

Author: tbonfort
Date: 2011/09/10 - 22:37
offset for polygon shapes is scaled by the layer's sizeunits/symbolscaledenom, and this also applies to the LABEL STYLE.

doc should be updated to indicate that offset is scaled in the same way as size, width, etc...

@mapserver-bot
Copy link
Author

Author: havatv
Date: 2011/09/12 - 11:56
Documentation seems to be OK for style offset. It is Label offsets that are said to be pixels.

The problem here seems to be the use of MAXSIZE and MINSIZE for the LABEL (if MINSIZE and MAXSIZE is not used, everything is OK).

Would it be possible to take LABEL MAXSIZE and MINSIZE into consideration when computing the OFFSET of a LABELPOLY (when symbol scaling is in effect)?

If not, I don't think it will be possible to use a backgroundshadow for labels in a layer with SYMBOLSCALEDENOM specified, and limits to label scaling (LABEL MINSIZE and MAXSIZE) in effect.

@mapserver-bot
Copy link
Author

Author: havatv
Date: 2011/11/09 - 00:01
I will explain some more, with a new map file and a new illustration. This has to do with labels with a backgroundcolour and backgroundshadow (specified using LABEL BACKGROUNDCOLOR, BACKGROUNDSHADOWCOLOR and BACKGROUNDSHADOWSIZE in pre-6.0 versions of Mapserver).

  1. geomtransform labelpoly with OFFSET works fine for non-scaled symbols (no LAYER SYMBOLSCALEDENOM).

  2. geomtransform labelpoly with OFFSET works fine for scaled symbols (SYMBOLSCALEDENOM specified), when there is no limit to scaling (no LABEL MINSIZE / MAXSIZE).

  3. geomtransform labelpoly with OFFSET does not work as expected for scaled symbols (SYMBOLSCALEDENOM specified) when the scaling is limited (LABEL MINSIZE / MAXSIZE). '''This has to be fixed in order to maintain the functionality of pre 6.0 Mapserver versions'''.

Here is a mapfile that demonstrates the problem. Run it with shp2img (FONTSET will have to reflect your system font path). At the bottom is the label resulting from the situation 1) above. At the top is the label resulting from the situation 3) above. In the middle is the label resulting from the situation 2) above. As you can see, for the label in the middle, the shadow offset is scaled without respecting the LABEL MINSIZE / MAXSIZE.

MAP
  SIZE 400 200
  EXTENT 0 0 400 200
  UNITS meters
  IMAGETYPE png

  FONTSET /usr/share/fonts/truetype/font.list

  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS 1 1 END
  END

  LAYER
    NAME "featurescaled"
    STATUS DEFAULT
    TYPE POINT
    SYMBOLSCALEDENOM 25000  # This causes problems in 6.0
    FEATURE
      TEXT "Label"
      POINTS
        10 90
      END
    END
    CLASS
      STYLE # black filled circle
        SYMBOL 'circle'
        MINSIZE 4
        SIZE 4
        MAXSIZE 4
        COLOR 0 0 0
      END
      LABEL
        STYLE # ------ Gray Box (shadow) ------
          GEOMTRANSFORM labelpoly
          COLOR 102 102 102
          OFFSET 2 2
        END
        STYLE # ------ Red Box ------
          GEOMTRANSFORM labelpoly
          COLOR 255 0 0
        END
        FONT "arial"
        TYPE TRUETYPE
        POSITION UR
        SIZE 12
        COLOR 0 0 0
      END
    END
  END # layerscale

  LAYER
    NAME "featurescaledminmax"
    STATUS DEFAULT
    TYPE POINT
    SYMBOLSCALEDENOM 25000
    FEATURE
      TEXT "Label"
      POINTS
        10 50
      END
    END
    CLASS
      STYLE # black filled circle
        SYMBOL 'circle'
        MINSIZE 4
        SIZE 4
        MAXSIZE 4
        COLOR 0 0 0
      END
      LABEL
        STYLE # ------ Gray Box (shadow) ------
            GEOMTRANSFORM labelpoly
            COLOR 102 102 102
            OFFSET 2 2
        END
        STYLE # ------ Red Box ------
            GEOMTRANSFORM labelpoly
            COLOR 255 0 0
        END
        FONT "arial"
        TYPE TRUETYPE
        POSITION UR
        MINSIZE 12
        SIZE 12
        MAXSIZE 12
        COLOR 0 0 0
      END
    END
  END # layer featurescaledminmax

  LAYER
    NAME "featurefixed"
    STATUS DEFAULT
    TYPE POINT
    FEATURE
      TEXT "Label"
      POINTS
        10 10
      END
    END
    CLASS
      STYLE # black filled circle
        SYMBOL 'circle'
        MINSIZE 4
        SIZE 4
        MAXSIZE 4
        COLOR 0 0 0
      END
      LABEL
        STYLE # ------ Gray Box (shadow) ------
            GEOMTRANSFORM labelpoly
            COLOR 102 102 102
            OFFSET 2 2
        END
        STYLE # ------ Red Box ------
            GEOMTRANSFORM labelpoly
            COLOR 255 0 0
        END
        FONT "arial"
        TYPE TRUETYPE
        POSITION UR
        SIZE 12
        COLOR 0 0 0
      END
    END
  END # layer fixed
END # Map file

@mapserver-bot
Copy link
Author

@mapserver-bot
Copy link
Author

@mapserver-bot
Copy link
Author

attachment http://trac.osgeo.org/mapserver/attachment/ticket/4015/labelshadow-offset.png :

   The new illustration generated from the mapfile in [comment:3 havatv]

@ghost ghost assigned tbonfort Apr 5, 2012
@havatv
Copy link

havatv commented Jun 27, 2016

@tbonfort, I had forgotten about this issue, but today I did a test with Mapserver 7.0.1, and found that there are still problems with the combination LABEL-> geomtransform 'labelpoly', LAYER-> symbolscaledenom and LABEL-> maxsize.
The problem is illustrated by the following example. Link: [http://gis.umb.no/cgi-bin/mapserv_7?map=/home/havatv/mapserver/tests/labelgeomtransformbug.map&template=openlayers]
Try to zoom in - the "shadow" (offset polygon) starts to move away from its expected position when LABEL-> maxsize is reached.

Map file for the example (only FONTSET and the WEB block should need modification):

MAP
  SIZE 1000 1000
  EXTENT 0 0 100 100
  IMAGETYPE png

  FONTSET /usr/share/fonts/truetype/font.list

  WEB
    IMAGEPATH "/home/havatv/public_html/mapserver/tmp/"
    IMAGEURL "/~havatv/mapserver/tmp/"
  END # WEB

  SYMBOL
    NAME "circle"
    TYPE ellipse
    FILLED true
    POINTS 1 1 END
  END

  LAYER
    NAME "testlabelpoly"
    STATUS DEFAULT
    TYPE POINT
    SYMBOLSCALEDENOM 200
    FEATURE
      TEXT "Test point"
      POINTS
        50 50
      END
    END
    CLASS
      STYLE
        COLOR 255 0 255
        SYMBOL 'circle'
    SIZE 7
        MAXSIZE 20
      END # style
      LABEL
        POSITION UR
        TYPE truetype
        FONT arial
        SIZE 10
        MINSIZE 5
        MAXSIZE 20
        COLOR 0 0 0
        STYLE
          GEOMTRANSFORM 'labelpoly'
          COLOR 153 153 153
          OFFSET 2 1
        END # STYLE
        STYLE
          GEOMTRANSFORM 'labelpoly'
          COLOR 220 220 204
        END # STYLE
      END # LABEL
    END  # CLASS
  END # LAYER
END # Map file

@havatv
Copy link

havatv commented Jul 3, 2017

@tbonfort, the issue persists in 7.0.6 (I was reminded by a discussion on mapserver-dev@lists.osgeo.org ("drop shadow for labels") 21 May).
See:
http://gis.umb.no/cgi-bin/mapserv_7?map=/home/havatv/mapserver/tests/labelgeomtransformbug.map&template=openlayers
Zoom in, and the "shadow" shows up nicely until the LABEL->MAXSIZE is reached. Then the shadow moves away from the label (the shadow size remains correct).
I think this issue should be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants