How to use the @here/harp-features-datasource.MapViewPolygonFeature function in @here/harp-features-datasource

To help you get started, we’ve selected a few @here/harp-features-datasource examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github heremaps / harp.gl / @here / harp-examples / src / features.ts View on Github external
* ```
 *
 * 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 {

@here/harp-features-datasource

Provides support for custom features

Apache-2.0
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages