2
制作矢量层GeoJSON的我用来做GML载体是这样的:在openlayer
layer = new OpenLayers.Layer.GML("based",
"./parser2.php",
{
isBaseLayer: true,
format: OpenLayers.Format.GeoJSON,
styleMap: new OpenLayers.StyleMap(mystyle),
units:"m",
maxResolution: 0.2,
minResolution: 0.01
})
map.addLayer(layer);
,但现在贬值了多个存在的我需要使用OpenLayers.Layer.Vector,但我不能赢得成功阅读geoJon文件。 我试过像这样:
var test = new OpenLayers.Layer.Vector("test", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
isBaseLayer: true,
url: "data.json",
styleMap: myStyles,
format: new OpenLayers.Format.JSON()
})
});
map.addLayer(test);
但很不幸的是它不工作。
你有什么线索吗?
感谢