openlayer 加载geojson数据不显示问题

json数据没问题

加载geojson后无法显示图形

解决:发现少加了个策略

equipmentDatasLayer = new OpenLayers.Layer.Vector('数据图层', {  
		projection: new OpenLayers.Projection('EPSG:4326'),  
		protocol: new OpenLayers.Protocol.HTTP({  
			url: 'map.json',  
			format: new OpenLayers.Format.GeoJSON({
				read: function(json,type,filter){
				    var geojson = new OpenLayers.Format.GeoJSON();  
				    var features =geojson.read(json,"FeatureCollection");//FeatureConllection与json数据中type对应
				    refreshData(features);
				}
			})  
		}),  
		strategies: [new OpenLayers.Strategy.Fixed()],
		styleMap: equipmentDatas_style
	});


你可能感兴趣的:(webgis)