2009年12月17日木曜日

OpenLayers 41b Styled Layer Descriptor (SLD) - 鉄道データレイヤの追加

tokyo_pf_gpis.map ファイルを修正します。
WFS サーバの設定をします。

---
WEB
IMAGEPATH "/home/user/ka-map/htdocs/tmp/kacache/" #ka-Map の設定
IMAGEURL "/ka-map/tmp/kacache/" #ka-Map の設定
METADATA
"wms_title" "Tokyo mlit Map WMS Server" # WMS サーバ設定
"wms_onlineresource" "http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map" # WFS サーバ設定
"wms_srs" "EPSG:2456 EPSG:4326" #
"wfs_title" "Tokyo mlit Map WFS Server" # WFS サーバ設定
"wfs_onlineresource" "http://192.168.1.6/cgi-bin/mapserv?map=/home/user/mapfile/tokyo_pf_pgis.map" # WFS サーバ設定
"wfs_srs" "EPSG:2456 EPSG4326" # WFS サーバ設定
END
---

int: 「事業者種別コード」別にレイヤを作成します。

---
# 新幹線
LAYER
NAME shinkansen
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 追加
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '1') as railroadquery using unique gid using srid = -1" #1
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Shinkansen mlit WMS Layer" # 追加
"wfs_title" "Shinkansen mlit WFS Layer" # 追加
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
CLASS
NAME "新幹線"
STYLE
COLOR 102 102 255
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_railroad_pgis.html
END

# JR 在来線

LAYER
NAME jrline
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 追加
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '2') as railroadquery using unique gid using srid = -1" #1
# MAXSCALEDENOM 500000
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Shinkansen mlit WMS Layer" # 追加
"wfs_title" "Shinkansen mlit WFS Layer" # 追加
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
CLASS
NAME "JR 在来線"
STYLE
COLOR 255 102 102
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_railroad_pgis.html
END

# 公営鉄道

LAYER
NAME publicline
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 追加
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '3') as railroadquery using unique gid using srid = -1" #1
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Public Line mlit WMS Layer" # 追加
"wfs_title" "Public Line mlit WFS Layer" # 追加
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
CLASS
NAME "公営鉄道"
STYLE
COLOR 255 102 255
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_railroad_pgis.html
END

# 民営鉄道
 
LAYER
NAME privateline
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 追加
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '4') as railroadquery using unique gid using srid = -1" #1
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Private Line mlit WMS Layer" # 追加
"wfs_title" "Private Line mlit WFS Layer" # 追加
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
CLASS
NAME "民営鉄道"
STYLE
COLOR 102 255 102
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_railroad_pgis.html
END

# 第3セクター

LAYER
NAME thirdsec
GROUP railroad
TYPE LINE
STATUS ON
DUMP TRUE # 追加
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from (select * from railroad2 where int = '5') as railroadquery using unique gid using srid = -1" #1
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "lin" #
"fields" "opc:運営会社,lin:路線名" # ここまで
"wms_title" "Private Line mlit WMS Layer" # 追加
"wfs_title" "Private Line mlit WFS Layer" # 追加
"gml_featureid" "gid" # 追加
"gml_include_items" "all" # 追加
END
CLASS
NAME "第3セクター"
STYLE
COLOR 255 255 102
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_railroad_pgis.html
END

# 駅

LAYER
NAME railroad3
GROUP railroad
TYPE LINE
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=balanced"
DATA "the_geom from railroad3"
MAXSCALEDENOM 1000
LABELITEM "lin"
METADATA
"group_title" "鉄道"   #ka-Map の設定
"queryable" "true" #
"searchfield" "stn" #
"fields" "stn:駅名" # ここまで
"wms_title" "Railroad mlit Map WMS Layer" # 追加
"wfs_title" "Railroad mlit Map WFS Layer" # 追加
"gml_featureid" "gid" # 追加?
"gml_include_items" "all" # 追加
END
CLASS
NAME "駅"
STYLE
SYMBOL 'circle'
COLOR 102 102 102
WIDTH 1
END
LABEL
MINFEATURESIZE 100
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF8
SIZE 8
END
END
TEMPLATE temp_station_pgis.html
END

END # End of Mapfile

temp_railroad_pgis.html

<html>
<head>
<title>Railroad pgis Template</title>
</head>
<body>
<li>[lin]
</body>
</html>

temp_station_pgis.html

<html>
<head>
<title>Station pgis Template</title>
</head>
<body>
<li>[stn]
</body>
</html>

0 件のコメント: