跳到主要内容

添加面

在场景中添加面。

代码示例
// 注:目前只支持渲染features[0]这个多边形,数组中其它的多边形不渲染
let data = {
"type": "FeatureCollection",
"name": "test",
"crs": {"type": "name", "properties": {"name": "urn:ogc:def:crs:OGC:1.3:CRS84"}},
"features": [
{
"type": "Feature", "properties": {"id": 1,"height":20}, "geometry": {
"type": "MultiPolygon",
"coordinates": [[[[120.711625761972059, 31.319903719752887], [120.710521432941903, 31.318671510113795], [120.711558149990637, 31.318190173844027], [120.712820240310805, 31.318170920342073], [120.714127405285268, 31.318517482775142], [120.713947106668101, 31.320173263462038], [120.711625761972059, 31.319903719752887]], [[120.713068150909422, 31.319788200784199], [120.713496360125177, 31.319980732319969], [120.713744270723794, 31.319576415640203], [120.71331606150801, 31.319383883277759], [120.713068150909422, 31.319788200784199]], [[120.713338598835151, 31.319075830679019], [120.71324844952656, 31.318729270300832], [120.713766808050934, 31.318690763513413], [120.713811882705201, 31.319075830679019], [120.713338598835151, 31.319075830679019]], [[120.712662479020779, 31.319865213445727], [120.71173844860779, 31.319807453955484], [120.710972179484827, 31.318902550649351], [120.712008896533561, 31.318459722458204], [120.712910389619395, 31.318498229340129], [120.713068150909422, 31.319075830679019], [120.713023076255112, 31.31944164302783], [120.712662479020779, 31.319865213445727]]]]
}
}
]
}

let options = {
"color": "#3bba1f"
}

mapmostUE.addPolygon("test", data, options);
效果
show