gpt4 book ai didi

javascript - 如何在 OpenLayers 中从 GML 矢量图层升级到 VECTOR

转载 作者:行者123 更新时间:2023-11-30 05:55:58 25 4
gpt4 key购买 nike

根据 OpenLayers 的说法,Openlayers.Layer.GML 已贬值并且在版本中不受支持。 2.12.我需要移动到矢量图层,但我想不通。

在我之前的版本中,我将其定义为:

           //Locations and UnitLocations layer - GeoJSON
var LocationStyle = new OpenLayers.Style({
strokeColor: "#5B5B5B",
strokeWidth: 1,
fillColor: "#F4FBA1",
pointRadius: 10,
strokeOpacity: 0.8,
fillOpacity: 0.8,
label: "${Location}",
labelYOffset: "-20",
labelAlign: "cc",
fontColor: "#000000",
fontOpacity: 1,
fontFamily: "Arial",
fontSize: 12,
fontWeight: "300"
});


var LocationURL = "http://bit.ly/Nfe6IH?q=ICS_Locations&IncidentCode=" + "VAJA%20PSI%2012" + "&key=" + Math.random();
Locations = new OpenLayers.Layer.GML("Locations", LocationURL, {
format: OpenLayers.Format.GeoJSON,
projection: new OpenLayers.Projection("EPSG:4326"), //4326 for WGS84
styleMap: new OpenLayers.StyleMap(LocationStyle)
});

在版本中。 Openlayers 的 2.12 不再支持此功能。您有任何示例吗?我怎样才能做到这一点?

谢谢。

最佳答案

// format use: new OpenLayers.Format.GPX

var orange = new OpenLayers.Layer.Vector("gpx", {
protocol: new OpenLayers.Protocol.HTTP({
url: "mGPX_123123123.gpx",
format: new OpenLayers.Format.GPX
}),
strategies: [new OpenLayers.Strategy.Fixed()],
visibility: true,
projection: new OpenLayers.Projection("EPSG:4326")
});
myMap.addLayer(orange);

// refer http://osgeo-org.1560.n6.nabble.com/PB-V-2-12-and-Layer-GML-td4984663.html

关于javascript - 如何在 OpenLayers 中从 GML 矢量图层升级到 VECTOR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11882159/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com