执行此操作时,我在地图上得到两个点,但是当我缩放图像时,图像变得更小。
如何保持图像的大小固定?下面是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();
}
}