2

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)
            });

バージョンで。2.12 の Openlayers では、これはサポートされなくなりました。どうすればそれを達成できますか?

ありがとうございました。

4

2 に答える 2

1
// 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
于 2012-08-27T18:16:26.797 に答える
0

以下のコードを調整してみてください。

Locations = new OpenLayers.Layer.Vector("Locations", {
                strategies: [new OpenLayers.Strategy.Fixed()], 
                protocol: new OpenLayers.Protocol.HTTP({
                     url: LocationURL,
                     format: new OpenLayers.Format.GeoJSON()

                }),
                displayInLayerSwitcher: false,

            });
于 2012-08-10T07:38:17.920 に答える