Creating Polygons
Creating a Polygon
Single Part Polygon
Multiple Parts Polygon
Polygon with Holes
function createPolygon() {
// 1. Create a polygon object
var polygon = Module.createPolygon("MY_POLYGON");
// 2. Set coordinates and parts
var vertex = new Module.JSVec3Array();
vertex.push(new Module.JSVector3D(126.9288, 37.526449, 15.0));
vertex.push(new Module.JSVector3D(126.927471, 37.525806, 15.0));
vertex.push(new Module.JSVector3D(126.928596, 37.5246, 15.0));
vertex.push(new Module.JSVector3D(126.929996, 37.525416, 15.0));
var part = new Module.Collection();
part.add(4);
polygon.setPartCoordinates(vertex, part);
// 3. Set polygon color (optional)
var polygonStyle = new Module.JSPolygonStyle();
polygonStyle.setFill(true);
polygonStyle.setFillColor(new Module.JSColor(255, 0, 0));
polygonStyle.setOutLine(true);
polygonStyle.setOutLineWidth(2.0);
polygonStyle.setOutLineColor(new Module.JSColor(0, 0, 255));
polygon.setStyle(polygonStyle);
// 5. Store the polygon in a layer
var layerList = new Module.JSLayerList(true);
var layer = layerList.createLayer("POLYGON_LAYER", Module.ELT_POLYHEDRON);
layer.addObject(polygon, 0);
}Step 1. Create a Polygon Object
Step 2. Specify the Shape of the Polygon

Step 3. Set Properties for the Polygon (Optional)
Step 4. Store the Polygon in a Layer
Polygon Creation Result

Last updated


