「205-ol3ex.js」
var layers = [
// 'ol.layer.Tile' では地図が表示できませんでした
// new ol.layer.Tile({
// source: new ol.source.TileWMS({
new ol.layer.Image({
source: new ol.source.ImageWMS({
attributions: [new ol.Attribution({
/* html: '© ' + * '<a href="http://www.geo.admin.ch/internet/geoportal/' + * 'en/home.html">' + * 'Pixelmap 1:1000000 / geo.admin.ch</a>' */ html: '基盤地図情報' })], // crossOrigin: 'anonymous',
params: {
// 'LAYERS': 'ch.swisstopo.pixelkarte-farbe-pk1000.noscale',
'MAP' : '/home/user/mapfile/nippon_bmi_akiruno_pgis.map',
'LAYERS': 'akiruno_kukaku',
// 'FORMAT': 'image/jpeg' // 地図以外の部分が黒くなるため
'VERSION': '1.1.1' // '1.3.0' では地図が表示できませんでした
},
// url: 'http://wms.geo.admin.ch/', url: 'http://localhost/cgi-bin/mapserv?' }) }),
new ol.layer.Image({
source: new ol.source.ImageWMS({
attributions: [new ol.Attribution({
/*
* html: '© ' +
* '<a href="http://www.geo.admin.ch/internet/geoportal/' +
* 'en/home.html">' +
* 'National parks / geo.admin.ch</a>'
*/
html: '基盤地図情報'
})],
// crossOrigin: 'anonymous',
// params: {'LAYERS': 'ch.bafu.schutzgebiete-paerke_nationaler_bedeutung'},
params: {
'MAP' : '/home/user/mapfile/nippon_bmi_akiruno_pgis.map',
'LAYERS': 'akiruno_kenchiku',
'VERSION': '1.1.1'
},
serverType: 'mapserver', // url: 'http://wms.geo.admin.ch/' url: 'http://localhost/cgi-bin/mapserv?' }) }) ];
// A minimal projection object is configured with only the SRS code and the map // units. No client side coordinate transforms are possible with such a // projection object.
var projection = new ol.proj.Projection({
// code: 'EPSG:21781',
code: 'EPSG:2451',
units: 'm'
});
var map = new ol.Map({
/* 座標系の設定がないとスケールが表示されません
* controls: ol.control.defaults().extend([
* new ol.control.ScaleLine({
* units: 'metric'
* })
* ]),
*/
layers: layers,
// 'example-behavior.js' により URL にある renderer を返します
renderer: exampleNS.getRendererFromQueryString(),
target: 'map',
view: new ol.View2D({
// center: [660000, 190000],
center: [-54250, -29350],
projection: projection,
// zoom: 9
zoom: 12 // 座標系の設定がない場合とある場合で数値が違います
})
});





































