xxxxxxx

 
    <button id="vector_map_id" class="add_but" style="margin-left: 30px;">矢量地图</button>
 
    //添加建筑物模型
    var build3dmodel_map_flag = true;
    var build3dmodel_option = {
        url: 'http://220.171.42.86:8092//xj_building_3dtiles/3Dtiles/tileset.json'
    };
    var build3dModel = new smtmap.Build3DModel(build3dmodel_option);
    $('#build3dmodel_map_id').click(function(){
        if(build3dmodel_map_flag){
            map.addBuild3DModel(build3dModel);
            build3dmodel_map_flag = false;
        }else{
            map.removeBuild3DModel(build3dModel);
            build3dmodel_map_flag = true;
        }
    });

    
    //添加模型
    var model_options = {
        id: '100',
        name: 'first model',
        show: true,
        description: 'this is a model',
        position: [117, 40],
        model: new smtmap.ModelGraphics({
            uri: './smartmap/data/barrel.gltf',
            minimumPixelSize: 128,
            maximumScale: 20000
        })
    };
    var model = new smtmap.Entity(model_options);
    // map.addEntity(model);

    //添加geojson
    var geojson = {
        "type": "FeatureCollection",
        "features": [
            {
                "type": "Feature",
                "properties": {},
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            [92.46726210481532, 37.35657108914954],
                            [93.77795102398596, 37.26959263167123],
                            [93.8025097123043, 36.647712158703705],
                            [92.7198752717614, 36.8584889310408],
                            [92.46726210481532, 37.35657108914954]
                        ]
                    ]
                }
            },
            {
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [95.301, 35.915]
                },
                "properties": {
                    "name": "Dinagat Islands"
                }
            },
            {
                "type": "Feature",
                "properties": {},
                "geometry": {
                    "type": "LineString",
                    "coordinates": [
                        [100.80517267883982, 33.52344778738012],
                        [101.8234853625771, 33.06028378604891],
                        [103.66536632020846, 32.92139892]
                    ]
                }
            }
        ]
    }
    var options = {
        polygon:{
            color: new smtmap.Color(255, 0, 255, 100),
            outline: true,
            outlineColor: new smtmap.Color(100, 100, 100, 233)
        },
        point: {
            pixelSize: 10,
            fillColor: new smtmap.Color(20, 70, 50, 255),
            outlineColor: new smtmap.Color(233, 244, 2, 244),
            outlineWidth: 2,
            fontColor: new smtmap.Color(255, 255, 99, 233),
            showBackground: true,
            backgroundColor: new smtmap.Color(40, 99, 22, 150)
        },
        line:{
             10,
            color: new smtmap.Color(250, 100, 200, 200)
        }
    };
    // map.addGeoJson(geojson, options);
 
原文地址:https://www.cnblogs.com/chenghu/p/15414655.html