-
-
Save iljya/b1d58f250be11e8972ea6e5628f84b2a to your computer and use it in GitHub Desktop.
MAP | |
NAME SYMBOL_LABEL_COLLISION_TEST | |
SIZE 500 500 | |
EXTENT 0 0 1 1 | |
IMAGECOLOR 255 255 255 | |
IMAGETYPE svg | |
CONFIG "MS_ERRORFILE" "stderr" | |
SYMBOL | |
NAME "square_05_05" | |
TYPE svg | |
IMAGE "./square.svg" | |
ANCHORPOINT 0.5 0.5 | |
END | |
LAYER | |
TYPE LINE | |
STATUS ON | |
FEATURE | |
POINTS | |
0 0 | |
0.5 0.5 | |
1 1 | |
END | |
TEXT "HELLO" | |
END | |
CLASS | |
STYLE | |
COLOR 255 0 0 | |
END | |
LABEL | |
COLOR 150 150 150 | |
SIZE 50 | |
ANGLE AUTO | |
POSITION CC | |
#FORCE TRUE | |
END | |
END | |
END | |
LAYER | |
TYPE POINT | |
STATUS ON | |
FEATURE | |
POINTS | |
0.25 0.25 | |
END | |
END | |
CLASS | |
STYLE | |
SIZE 150 | |
SYMBOL "square_05_05" | |
END | |
END | |
END | |
END |
I have modified your example a little bit.
I You add REPEATDISTANCE for the text and then a fake label with transparent text above the svg symbol
I think that You get something that is close to what you are looking for.
If You remove the last fake label block You get the old behavior that the text is written above the symbol.
`MAP
NAME SYMBOL_LABEL_COLLISION_TEST
SIZE 500 500
EXTENT 0 0 1 1
IMAGECOLOR 255 255 255
IMAGETYPE svg
CONFIG "MS_ERRORFILE" "stderr"
SYMBOL
NAME "square_05_05"
TYPE svg
IMAGE "./square.svg"
ANCHORPOINT 0.5 0.5
END
LAYER
TYPE LINE
STATUS ON
FEATURE
POINTS
0 0
0.5 0.5
1 1
END
TEXT "HELLO"
END
CLASS
STYLE
COLOR 255 0 0
END
LABEL
COLOR 150 150 150
SIZE 15
ANGLE FOLLOW
POSITION AUTO
REPEATDISTANCE 200
END
END
END
LAYER
TYPE POINT
STATUS ON
FEATURE
POINTS
0.5 0.5
END
END
CLASS
STYLE
SIZE 50
SYMBOL "square_05_05"
END
LABEL
TEXT "X"
COLOR "#00000000"
SIZE 8
POSITION CC
END
END
END
END
`
Here is the result of rendering this map file with:
shp2img -o ~/Desktop/collision.svg -m collision.map
I expected to see the label in the top-right corner, avoiding the square symbol.