これを実行すると、マップ上に 2 つのポイントが表示されますが、ズームすると画像が小さくなります。
画像のサイズを固定するにはどうすればよいですか? 以下はJavaScriptコードです。
function init() {
var feature_data = {
"type":"FeatureCollection",
"features": [{
"type":"Feature",
"id":4,
"geometry": {
"type":"Point",
"coordinates": [65.216,33.677]
},
"properties": {
"name":"Afghanistan",
"population":25067407,
"pop_0_14":47,
"pop_15_59":49.3,
"pop_60_above":3.7
}
},
{
"type":"Feature",
"id":8,
"geometry": {
"type":"Point",
"coordinates":[20.068,41.143]
},
"properties: {
"name":"Albania",
"population":3153731,
"pop_0_14":26.3,
"pop_15_59":61.4,
"pop_60_above":12.3
}
}]
};
var map = new OpenLayers.Map('map_element',{});
var wms_layer = new OpenLayers.Layer.WMS('OpenLayers WMS',
'http://vmap0.tiles.osgeo.org/wms/vmap0',
{layers: 'basic'},
{}
);
var format_geojson = new OpenLayers.Format.GeoJSON({});
var vector_strategies = new OpenLayers.Strategy.Cluster({});
var vector_layer= new OpenLayers.Layer.Vector('bar graph visualization',
{strategies: vector_strategies}
);
vector_layer.addFeatures(format_geojson.read(feature_data));
map.addLayers([wms_layer,vector_layer]);
if(!map.getCenter()) {
map.zoomToMaxExtent();
}
}