从2D数组中获取两列并插入一个有趣的数组

时间:2017-05-10 20:31:21

标签: javascript cesium

我有一个功能是用Cesium绘制多边形。对于我想要的hierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([])来自CSV文件的数据。并且CSV文件有6列。我只想用第3和第4列来代替

-120.03, 30.464,
-120.43, 30.779,
-120.85, 31.12, 

所以,我该怎么做?

<script id="cesium_sandcastle_script">
    function startup(Cesium) {
        'use strict';

        //Sandcastle_Begin
        Cesium.Math.setRandomNumberSeed(1234);

        var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false });
        var entities = viewer.entities;

        entities.add({
            polygon : {
                hierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray([
                    -120.03, 30.464,
                    -120.43, 30.779,
                    -120.85, 31.12,
                ])),

                extrudedHeight : 99900.0,
                outline : true,
                outlineColor : Cesium.Color.WHITE,
                outlineWidth : 4,
                material : Cesium.Color.fromRandom({alpha : 0.5})
            }
        });

code 这是来自csv的数据

ID,索引,经纬度,地板,天花板 No1,0,30.464,-120.03,0,99900 No1,1,30.779,-120.43,0,99900 No1,2,31.12,-120.85,0,99900 No1,3,31.477999999999998,-121.28,0,99900 No1,4,31.846999999999998,-121.71000000000001,0,99900 No1,5,32.418,-122.36999999999999,0,99900 No1,6,32.905,-121.74,0,99900

0 个答案:

没有答案