С огромной помощью сообщества форума у меня есть отлично работающий map-файл, содержимое которого привожу ниже:
Код: Выделить всё
MAP
CONFIG "CPL_DEBUG" "ON"
CONFIG "PROJ_DEBUG" "ON"
DEBUG 5
SIZE 256 256
IMAGETYPE PNG
IMAGECOLOR 235 235 235
TRANSPARENT true
UNITS METERS
SYMBOL
NAME 'circlef'
TYPE ellipse
FILLED true
POINTS
3 3
END #POINTS
END #SYMBOL
SYMBOL
NAME "arrow"
TYPE vector
FILLED true
POINTS
0 0
8 3
0 6
0 0
END
ANCHORPOINT 0.5 0.5
END
LAYER
STATUS DEFAULT
CONNECTIONTYPE postgis
NAME segments
VALIDATION
# 'DATA' '^[0-9a-zA-Z\-\.\,\'\"\(\)\:\=\>\<\!\_\ ]+$'
# 'car' '^[a-zA-Z]+$'
"car" "^[0-9]+$"
"speed" "^[0-9]+$"
"fromd" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"fromt" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
"tod" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"tot" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
END
CONNECTION "user=________ dbname=__________ host=___________"
# Ваш запрос на рисование полилинии
DATA "geom from (
select
st_makeline(p1, p2) as geom, gid, num, speed
from
(
select
gid, row_number() over w as num, date_p as ts1, speed, location as p1, lead(location) over w as p2, lead(date_p) over w as ts2
from
gps_points
where
id_car=%car%
and date_p>='%fromd% %fromt%'::date
and date_p<='%tod% %tot%'::date
window w as (partition by id_car order by date_p)
) as query where p2 is not NULL
) as foo using unique gid using srid=900913"
TYPE LINE
STATUS ON
TYPE LINE
CLASS
EXPRESSION ([speed] < %speed%)
STYLE
COLOR 28 130 0
WIDTH 3
END
END
CLASS
EXPRESSION ([speed] > %speed%)
STYLE
COLOR 219 52 49
WIDTH 3
END
END
METADATA
wms_title "world"
wms_abstract "world test"
wms_srs "epsg:900913"
wms_include_items "all"
"wms_enable_request" "*"
END #METADATA
END
LAYER
VALIDATION
"car" "^[0-9]+$"
"fromd" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"fromt" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
"tod" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"tot" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
END
CONNECTIONTYPE postgis
NAME "path"
CONNECTION "user=________ dbname=__________ host=___________"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "geom from (select ST_MakeLine(location) as geom, 0 as gid from (select location, gid from gps_points where active = true and id_car=%car% and date_p>='%fromd% %fromt%'::date and date_p<='%tod% %tot%'::date order by date_p asc) as track_data) as foo using unique gid using srid=900913"
#FILTER "foo.id_car = '%car%'"
STATUS ON
TYPE LINE
CLASS
STYLE
#GEOMTRANSFORM "end"
ANTIALIAS TRUE
COLOR 55 12 253
SYMBOL "arrow"
SIZE 5
ANGLE AUTO # угол
#GAP 10 # Расстояние между стрелками
END # STYLE
END #CLASS
METADATA
wms_title "Track"
wms_abstract "Map file for track format"
wms_srs "epsg:900913"
wms_include_items "all"
"wms_enable_request" "*"
END #METADATA
END #LAYER
LAYER
VALIDATION
"car" "^[0-9]+$"
"fromd" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"fromt" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
"tod" "^20[0-9]{2}-[0-9]{1,2}-[0-9]{1,2}$"
"tot" "^[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}$"
END NAME "points"
CONNECTIONTYPE postgis
CONNECTION "user=postgres dbname=mapserver host=localhost"
PROCESSING "CLOSE_CONNECTION=DEFER"
DATA "the_geom from (select location as the_geom, speed, gid from gps_points where active = true and id_car=%car% and date_p>='%fromd% %fromt%'::date and date_p<='%tod% %tot%'::date ) as geom using unique gid using srid=900913"
STATUS ON
TYPE POINT
CLASS
EXPRESSION ([speed] <= 60)
STYLE
ANTIALIAS TRUE
SYMBOL "circlef"
COLOR 28 93 162
SIZE 6
GAP 1
END #STYLE
END #CLASS
CLASS
EXPRESSION ([speed] > 60)
STYLE
ANTIALIAS TRUE
SYMBOL "circlef"
COLOR 180 50 50
SIZE 6
GAP 1
END #STYLE
END #CLASS
METADATA
wms_title "world"
wms_abstract "world test"
wms_srs "epsg:900913"
wms_include_items "all"
"wms_enable_request" "*"
END #METADATA
###
CLUSTER
MAXDISTANCE 10
REGION "ellipse"
END
#CLUSTER
###
# LABELITEM "Cluster_FeatureCount"
END #LAYER
PROJECTION
"init=epsg:900913"
# "proj=latlong"
# "ellps=WGS84"
# "datum=WGS84"
# "init=epsg:3857"
END #PROJECTION
END
Были попытки вывести при помощи SYMBOL, но к сожалению, по разным причинам (иногда не совсем понятным для меня) вывод не удавался.
Спасибо заранее!