[mapserver-users] KML in mapserver
Schylberg Lars
lars.schylberg at saabgroup.com
Tue Mar 10 07:20:28 PDT 2015
This was a good exercise to handle KML files.
To get this to work You have to cast the Style value to a string also.
DATA "SELECT Name as NAME, CAST(OGR_STYLE AS character(32)) AS STYLE FROM 'Fibertech solution' WHERE OGR_GEOMETRY='LINESTRING'"
The Mapfile should something like this:
# Start of LAYER DEFINITIONS -----------------------------
LAYER
NAME "kml_example"
GROUP LINES
TYPE LINE
STATUS ON
CONNECTIONTYPE OGR
CONNECTION "doc_test.kml"
DATA "SELECT Name as NAME, CAST(OGR_STYLE AS character(32)) AS STYLE FROM 'Fibertech solution' WHERE OGR_GEOMETRY='LINESTRING'"
CLASSITEM "STYLE"
LABELITEM "NAME"
CLASS
# EXPRESSION ([STYLE] = '@msn_ylw-pushpin4')
EXPRESSION "@msn_ylw-pushpin4"
NAME "Fiber Names 4"
STYLE
COLOR 250 0 0
WIDTH 2.5
END
LABEL
SIZE TINY
COLOR 255 100 100
POSITION AUTO
END
END
CLASS
# EXPRESSION ([STYLE] = '@msn_ylw-pushpin8')
EXPRESSION "@msn_ylw-pushpin8"
NAME "Fiber Names 8"
STYLE
COLOR 0 255 0
WIDTH 3.1
END
LABEL
SIZE TINY
COLOR 100 255 100
POSITION AUTO
END
END # Class
END # Layer
LAYER
NAME "kml_example_point"
GROUP PONITS
TYPE POINT
STATUS DEFAULT
CONNECTIONTYPE OGR
CONNECTION "doc_test.kml"
DATA "SELECT * FROM 'Fibertech solution' WHERE OGR_GEOMETRY='POINT'"
LABELITEM "Name"
CLASS
#NAME "Fiber Names"
STYLE
COLOR 0 0 255
SYMBOL 'circlef'
SIZE 16
END
END # Class
END # Layer
END # Map
More information about the MapServer-users
mailing list