How to use the @here/harp-geojson-datasource.GeoJsonDataProvider function in @here/harp-geojson-datasource

To help you get started, we’ve selected a few @here/harp-geojson-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 / test / rendering / GeoJsonDataRendering.ts View on Github external
const lookAt = mergeWithOptions(defaultLookAt, options.lookAt);

        mapView.lookAt(
            new GeoCoordinates(lookAt.latitute, lookAt.longitude),
            lookAt.distance,
            lookAt.tilt,
            lookAt.azimuth
        );
        // Shutdown errors cause by firefox bug
        mapView.renderer.getContext().getShaderInfoLog = (x: any) => {
            return "";
        };

        const geoJsonDataSource = new OmvDataSource({
            decoder: new OmvTileDecoder(),
            dataProvider: new GeoJsonDataProvider(
                "geojson",
                typeof options.geoJson === "string"
                    ? new URL(options.geoJson, window.location.href)
                    : options.geoJson,
                { tiler: new GeoJsonTiler() }
            ),
            name: "geojson",
            styleSetName: "geojson"
        });

        mapView.addDataSource(geoJsonDataSource);

        await waitForEvent(mapView, MapViewEventNames.FrameComplete);

        await ibct.assertCanvasMatchesReference(canvas, options.testImageName);
    }
github heremaps / harp.gl / @here / harp-examples / src / datasource_geojson_points.ts View on Github external
link: "https://www.openstreetmap.org/copyright"
                }
            ]);

        sampleMapView.camera.position.set(2000000, 3500000, 6000000); // Europe.
        sampleMapView.geoCenter = new GeoCoordinates(16, -4, 0);

        MapControls.create(sampleMapView);
        sampleMapView.resize(window.innerWidth, window.innerHeight);

        window.addEventListener("resize", () => {
            sampleMapView.resize(window.innerWidth, window.innerHeight);
        });

        // Create a [[GeoJsonDataProvider]] from a GeoJson URL and plug it into an OmvDataSource.
        const geoJsonDataProvider = new GeoJsonDataProvider(
            "points",
            new URL("resources/points.json", window.location.href)
        );
        const geoJsonDataSource = new OmvDataSource({
            dataProvider: geoJsonDataProvider,
            name: "geojson",
            styleSetName: "geojson"
        });
        sampleMapView.addDataSource(geoJsonDataSource).then(() => {
            sampleMapView.imageCache.addImage("custom-icon", imageString, true);
            sampleMapView.poiManager.addImageTexture({
                name: "custom-icon",
                image: "custom-icon"
            });
        });
github heremaps / harp.gl / @here / harp-examples / src / datasource_geojson_choropleth.ts View on Github external
thresholds: [50, 100, 150, 200, 250, 300, 350, 400, 450],
        color: "#ff6600"
    });
    // end:geojson_heatmap2.ts

    // snippet:geojson_heatmap3.ts
    const customTheme = {
        extends: "resources/berlin_tilezen_night_reduced.json",
        styles: {
            geojson: densityStyleSet
        }
    };
    // end:geojson_heatmap3.ts
    const baseMap = initializeBaseMap("mapCanvas", customTheme);

    const geoJsonDataProvider = new GeoJsonDataProvider(
        "italy",
        new URL("resources/italy.json", window.location.href)
    );
    const geoJsonDataSource = new OmvDataSource({
        dataProvider: geoJsonDataProvider,
        styleSetName: "geojson"
    });
    baseMap.addDataSource(geoJsonDataSource);

    const infoElement = document.getElementById("info") as HTMLParagraphElement;
    infoElement.innerHTML =
        `This choropleth shows how to use custom styling to highlight specific features in the` +
        ` map. Here some height is given to the extruded polygons directly in the GeoJSON, ` +
        `whereas the color comes from the population density given in the properties.`;
}
github heremaps / harp.gl / @here / harp-examples / src / datasource_geojson_styling_game.ts View on Github external
mapView.resize(window.innerWidth, window.innerHeight);
    });
    mapView.canvas.addEventListener("contextmenu", e => e.preventDefault());
    const baseMap = new OmvDataSource({
        baseUrl: "https://xyz.api.here.com/tiles/herebase.02",
        apiFormat: APIFormat.XYZOMV,
        styleSetName: "tilezen",
        maxZoomLevel: 17,
        authenticationCode: accessToken,
        copyrightInfo
    });
    mapView.addDataSource(baseMap);
    // end:harp_gl_initmapview.ts

    // snippet:harp_gl_staticgeojson.ts
    const geoJsonDataProvider = new GeoJsonDataProvider(
        "italy",
        new URL("resources/italy.json", window.location.href)
    );

    const geoJsonDataSource = new OmvDataSource({
        dataProvider: geoJsonDataProvider,
        name: "geojson",
        styleSetName: "geojson",
        gatherFeatureAttributes: true
    });

    mapView.addDataSource(geoJsonDataSource).then(() => {
        setStyleSet();
        askName();
        mapView.canvas.addEventListener("click", displayAnswer);
    });
github heremaps / harp.gl / @here / harp-examples / src / datasource_geojson_techniques.ts View on Github external
link: "https://www.openstreetmap.org/copyright"
                }
            ]);

        sampleMapView.camera.position.set(2000000, 3500000, 6000000); // Europe.
        sampleMapView.geoCenter = new GeoCoordinates(16, -4, 0);

        MapControls.create(sampleMapView);
        sampleMapView.resize(window.innerWidth, window.innerHeight);

        window.addEventListener("resize", () => {
            sampleMapView.resize(window.innerWidth, window.innerHeight);
        });

        // Create a [[GeoJsonDataProvider]] from a GeoJson URL and plug it into an OmvDataSource.
        const geoJsonDataProvider = new GeoJsonDataProvider(
            "basicFeatures",
            new URL("resources/basicFeatures.json", window.location.href)
        );
        const geoJsonDataSource = new OmvDataSource({
            dataProvider: geoJsonDataProvider,
            name: "geojson",
            styleSetName: "geojson"
        });
        sampleMapView.addDataSource(geoJsonDataSource).then(() => {
            sampleMapView.imageCache.addImage("custom-icon", imageString, true);
            sampleMapView.poiManager.addImageTexture({
                name: "custom-icon",
                image: "custom-icon"
            });
        });
github heremaps / harp.gl / @here / harp-features-datasource / lib / FeaturesDataSource.ts View on Github external
constructor(options?: FeatureDataSourceOptions) {
        super({
            ...options,
            dataProvider: new GeoJsonDataProvider(NAME, DEFAULT_GEOJSON, options)
        });
        if (options !== undefined) {
            if (options.features !== undefined) {
                this.add(...options.features);
            }
            if (options.geojson !== undefined) {
                this.setFromGeojson(options.geojson);
            }
        }
    }