tokyo_shp2.mapをコピーしてtokyo_pgis_color.mapを作成します。
マップファイルのレイヤ部分を記述します。
MAP
NAME tokyo_pgis_color_map
---
LAYER
NAME gyoseikai
GROUP gyoseikai
TYPE POLYGON
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=password"
DATA "the_geom FROM (
SELECT gyoseikai.gid AS gid,
gyoseikai.con AS con,
gyoseikai.cn2 AS cn2,
gyoseikai.aac AS aac,
gyoseikai.the_geom AS the_geom,
population.total AS total,
population.male AS male,
population.female AS female,
population.foreigner AS foreigner
FROM gyoseikai LEFT OUTER JOIN population ON gyoseikai.aac = population.aac)
AS gyosei_pop USING UNIQUE gid USING SRID=-1"
LABELITEM "cn2"
METADATA
"group_title" "行政界"
"queryable" "true"
"searchfield" "cn2"
"fields" "con:郡政令,cn2:市区町村,total:人口"
END
CLASS
NAME "行政界"
STYLE
OUTLINECOLOR 153 153 153
END
LABEL
MINFEATURESIZE 40
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF-8
SIZE 8
END
END
TEMPLATE temp_tokyo_pgis.html #ここを修正
END
LAYER #ダミーのレイヤ
NAME gyoseikai2
GROUP totalpop
TYPE POLYGON
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=password"
DATA "the_geom FROM (
SELECT gyoseikai.gid AS gid,
gyoseikai.con AS con,
gyoseikai.cn2 AS cn2,
gyoseikai.aac AS aac,
gyoseikai.the_geom AS the_geom,
population.total AS total,
population.male AS male,
population.female AS female,
population.foreigner AS foreigner
FROM gyoseikai LEFT OUTER JOIN population ON gyoseikai.aac = population.aac)
AS gyosei_pop USING UNIQUE gid USING SRID=-1"
LABELITEM "cn2"
METADATA
"group_title" "人口"
END
CLASS
NAME "行政界"
STYLE
OUTLINECOLOR 153 153 153
END
LABEL
MINFEATURESIZE 40
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF-8
SIZE 8
END
END
END
LAYER #このレイヤを追加
NAME totalpop
GROUP totalpop
TYPE POLYGON
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=password"
DATA "the_geom FROM (
SELECT gyoseikai.gid AS gid,
gyoseikai.con AS con,
gyoseikai.cn2 AS cn2,
gyoseikai.aac AS aac,
gyoseikai.the_geom AS the_geom,
population.total AS total,
population.male AS male,
population.female AS female,
population.foreigner AS foreigner
FROM gyoseikai LEFT OUTER JOIN population ON gyoseikai.aac = population.aac)
AS gyosei_pop USING UNIQUE gid USING SRID=-1"
OPACITY 50
CLASSITEM "total"
METADATA
"group_title" "人口"
END
CLASS
NAME "50万人以上"
EXPRESSION ([total] >= 500000)
COLOR 255 0 0
END
CLASS
NAME "40万-50万人"
EXPRESSION ([total] < 500000 AND [total] >= 400000)
COLOR 255 51 51
END
CLASS
NAME "30万-40万人"
EXPRESSION ([total] < 400000 AND [total] >= 300000)
COLOR 255 102 102
END
CLASS
NAME "20万-30万人"
EXPRESSION ([total] < 300000 AND [total] >= 200000)
COLOR 255 153 153
END
CLASS
NAME "10万人-20万人"
EXPRESSION ([total] < 200000 AND [total] >= 100000)
COLOR 255 204 204
END
END
LAYER
NAME gun_seirei
GROUP gun_seirei
TYPE ANNOTATION
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "dbname=tokyo host=localhost user=user password=password"
DATA "the_geom FROM (
SELECT gyoseikai.gid AS gid,
gyoseikai.con AS con,
gyoseikai.cn2 AS cn2,
gyoseikai.aac AS aac,
gyoseikai.the_geom AS the_geom,
population.total AS total,
population.male AS male,
population.female AS female,
population.foreigner AS foreigner
FROM gyoseikai LEFT OUTER JOIN population ON gyoseikai.aac = population.aac)
AS gyosei_pop USING UNIQUE gid USING SRID=-1"
LABELITEM "con"
METADATA
"group_title" "郡政令"
"searchfield" "con"
"fields" "con:郡政令,cn2:市区町村,total:人口"
END
CLASS
NAME "郡政令"
LABEL
MINFEATURESIZE 40
TYPE TRUETYPE
FONT vl-gothic
ENCODING UTF-8
SIZE 8
POSITION uc
END
END
TEMPLATE temp_tokyo_pgis.html #ここを修正
END
END #MAP END
temp_tokyo_pgis.htmlを作成します。
temp_tokyo_shp.htmlをコピーしてファイル名を変えます。
内容を次のように修正します。
<html>
<head>
<title>Tokyo pgis Template</title> #ここを修正
</head>
<body>
<li>[con]
<li>[cn2]
<li>[total] #ここを追加
</body>
</html>
config.phpの内容をつぎのように修正します。
$aszTokyo = array (
'title' => 'Tokyo',
'path' => '/home/nob61/mapfile/tokyo_pgis_color.map',
'scales' => array( 500000, 250000, 100000 ),
'format' =>'PNG'
);
0 件のコメント:
コメントを投稿