統計地圖-立體面量圖

繪製統計地圖-立體面量圖

 

「立體面量圖」與一般「面量圖」之參數設定大致相同,可設定之參數請參考繪製統計地圖-面量圖
唯有增加設定一參數KMLwithZ,此項參數需配合開啟匯出KML參數設定exportKML

 

匯出含有Z值資訊之KML檔後,即可以使用此KML檔案疊入任何3D圖台之中。

 

程式碼如下:

           function DrawStatMap(data) {                                    //統計地圖繪製

                        var pChoropleth = {                                             //面量圖參數設定

                                classifyMethod: ClassifyMethod.QUANTILE,    //設定分級方法

                                classes: 5,                       //設定分級數

                                color: mColor,                                               //設定配色

                                KMLwithZ: true,                                            //KML檔附含Z值設定

                                useInt: true                                                    //使用整數進行統計設定

                        };           

                        var option = {                                                                //統計地圖參數設定

                                pChoropleth: pChoropleth,

exportKML: true,                                  //匯出KML檔設定

                                baseLevel: BaseLevel. TOWN

                        };

                        var containerObj = document.getElementById("MapView");        //指定互動式介面的DIV ID

                        var Map = new StatMap(containerObj, data, MapKind.CHOROPLETH, option);

//繪製統計地圖

                        Map.drawMap(function (result){

                                var kmlURL = result.kmlUrl;                        //使用result.kmlUrl屬性取得KML檔連結

                                DrawEarth(kmlURL);

});

           function DrawEarth(kml){            //繪製3D地圖

        if (tgKML != null)

                tgKML.removeKml();

        tgKML = new TGOS.TEKmlLayer(kml, {      //取出KML連結並加入KML圖層到地圖

                map: tg3dEarth,

                suppressInfoWindows: false,

                preserveViewport: true

        }, function (){});

           }

回到上方