[mapserver-users] KML in mapserver
Eichner, Andreas - SID
Andreas.Eichner at sid.sachsen.de
Tue Mar 10 08:39:09 PDT 2015
>
> 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'"
>
Good catch, Lars! With this bit of OGR magic classification work as intented.
To summarize the relevant parts:
LAYER
NAME "kml_line"
TYPE LINE
CONNECTIONTYPE OGR
CONNECTION "doc_test.kml"
# restrict features to geometry type LINESTRING and make OGR_STYLE accessible as (class)item
DATA "SELECT NAME, CAST(OGR_STYLE AS character(32)) AS STYLE FROM 'Fibertech solution' WHERE OGR_GEOMETRY='LINESTRING'"
LABELITEM "NAME"
CLASSITEM "STYLE"
CLASS
EXPRESSION "@msn_ylw-pushpin4"
...
END
CLASS
EXPRESSION "@msn_ylw-pushpin8"
...
END
END
> 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