Can somesone give me an example how can I draw a line from a geojson LineString in harp.gl? The tutorial and the doc missing it.
Currently I'm trying with this in index.js:
fetch('my_data.geojson')
.then(data => data.json())
.then(data => {
const geoJsonDataProvider = new harp.GeoJsonDataProvider("my_data", data);
const geoJsonDataSource = new harp.OmvDataSource({
dataProvider: geoJsonDataProvider,
name: "my_data"
});
map.addDataSource(geoJsonDataSource).then(() => {
const styles = [{
when: "$geometryType == 'line'",
renderOrder: 10000,
attr: {
color: 0x000000fe,
size: 30
}
}]
geoJsonDataSource.setStyleSet(styles);
map.update();
});
});
my_data.geojson generated at geojson.io
I just missed some properties from the style. With this style it works fine:
const styles = [{
"when": "$geometryType ^= 'line'",
"renderOrder": 1000,
"technique": "solid-line",
"attr": {
"color": "blue",
"opacity": 1,
"metricUnit": "Pixel",
"lineWidth": 4
}
}];
User contributions licensed under CC BY-SA 3.0