Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* ```
*
* Then we create a [[MapViewFeature]] and add it to a [[FeaturesDataSource]] with a custom
* [[StyleSet]].
* ```typescript
* [[include:harp_simple_features_example_1.ts]]
* ```
*/
export namespace SimpleFeaturesExample {
// snippet:harp_simple_features_example_0.ts
const map = createBaseMap();
// end:harp_simple_features_example_0.ts
// snippet:harp_simple_features_example_1.ts
// We need to replicate the first point in the last coordinate to close the polygon.
const polygon = new MapViewPolygonFeature([[[10, 50], [10, 30], [5, 30], [5, 50], [10, 50]]]);
const featuresDataSource = new FeaturesDataSource();
map.addDataSource(featuresDataSource).then(() => {
featuresDataSource.add(polygon).setStyleSet([
{
technique: "fill",
when: "$geometryType == 'polygon'",
renderOrder: 10000,
attr: {
color: "#ff0000"
}
}
]);
});
// end:harp_simple_features_example_1.ts
function createBaseMap(): MapView {