2008年9月29日月曜日

OpenLayers 11c Feature Style 色と大きさを変える HTMLファイル


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Feature Style Basic</title>
<link rel="stylesheet" href="theme/default/style.css" type="text/css" />
<style type="text/css">
#map {
width: 512px;
height: 512px;
border: 1px solid black;
}
</style>
<script src="lib/OpenLayers.js"></script>
<script type="text/javascript">
var map, layer2, layer3, layer4, layer5, layer6, layer7, layer8, layer9, layer10;
// layer1,
function init(){
OpenLayers.ProxyHost="/cgi-bin/proxy.cgi?url=";
map = new OpenLayers.Map('map', {
maxResolution: 'auto',
units: 'meters',
maxExtent: new OpenLayers.Bounds(-83624.557161,-96269.254733,-3366.679476,-36305.074927)
}
);
/* layer1 = new OpenLayers.Layer.WMS( "Kamakura Chojikai Sen WMS",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kamakura_pgis.map',
layers: 'chojisen,kenchiku,doro,tetsudo',
format: 'image/png'
},
{
projection: 'EPSG:2451'
}
);
*/
layer2 = new OpenLayers.Layer.WMS( "Kanagawa Gyosei Kukaku Sen WMS",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_pgis.map',
layers: 'kukaku',
format: 'image/png'
},
{
projection: 'EPSG:2451'
}
);

var style_lightgreen = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_lightgreen.fillColor = "#99ff99";
style_lightgreen.strokeColor = "#33ff33";
style_lightgreen.pointRadius = 3;
layer3 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Building",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'building'
},
{
style: style_lightgreen,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_lightblue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_lightblue.fillColor = "#9999ff";
style_lightblue.strokeColor = "#3333ff";
style_lightblue.pointRadius = 3;
layer4 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS National Office",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'national_office'
},
{
style: style_lightblue,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_lightred = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_lightred.fillColor = "#ff9999";
style_lightred.strokeColor = "#ff3333";
style_lightred.pointRadius = 3;
layer5 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Local Office",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'local_office'
},
{
style: style_lightred,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_lightsyan = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_lightsyan.fillColor = "#99ffff";
style_lightsyan.strokeColor = "#33ffff";
style_lightsyan.pointRadius = 3;
layer6 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Police",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'police'
},
{
style: style_lightsyan,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_lightmagenta = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_lightmagenta.fillColor = "#ff99ff";
style_lightmagenta.strokeColor = "#ff33ff";
style_lightmagenta.pointRadius = 3;
layer7 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Fire Station",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'fire_station'
},
{
style: style_lightmagenta,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_green = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_green.fillColor = "#33ff33";
style_green.strokeColor = "#00ff00";
style_green.pointRadius = 3;
layer8 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS School",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'school'
},
{
style: style_green,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_orange = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_orange.fillColor = "#ff9933";
style_orange.strokeColor = "#ff6600";
style_orange.pointRadius = 3;
layer9 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Hospital",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'hospital'
},
{
style: style_orange,
visibility: false,
projection: 'EPSG:4612'
}
);

var style_red = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
//Pointのプロパティ、塗りつぶし、輪郭、大きさ
style_red.fillColor = "#ff0000";
style_red.strokeColor = "#ff0000";
style_red.pointRadius = 3;
layer10 = new OpenLayers.Layer.WFS( "Kanagawa mlit WFS Post",
"http://localhost/cgi-bin/mapserv?",
{
map: '/home/nob61/mapfile/kanagawa_mlit_pgis_pf.map',
typename: 'post'
},
{
style: style_red,
visibility: false,
projection: 'EPSG:4612'
}
);

map.addLayers([layer2, layer3, layer4, layer5, layer6, layer7, layer8, layer9, layer10]);
// map.addLayer(layer1);
// map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
}
</script>
</head>
<body onload="init()">
<h1 id="title">Feature Style Basic</h1>

<div id="map"></div>

</body>
</html>

0 件のコメント: