-
Hi, The tutorial explains how to put a Three js object into the map with anchor. Howerver, imagine that you want to draw a line between two points. The way I draw one line was with the positions of the ThreeJS gemotry set to Zero and then use map Anchor but In the case of the line I would need two geographics references. This example draw a line but I can not change it to two grographics points. points.push(new THREE.Vector3(0, 0, 0)); |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@hugosoli , we don't have a way to draw a link between two map anchor points currently. Why not use geojson to render the line? If you need to add the geometry programatically, you can use the FeaturesDataSource, see: https://www.harp.gl/docs/master/examples/#datasource_features_lines-and-points.html Or go to: https://www.harp.gl/docs/master/examples/#geojson-viewer.html And try something like:
|
Beta Was this translation helpful? Give feedback.
-
Yes, based on the recomendation of @nzjony I dig arround the projections classes. This solution work for me. function drawLineBetween(poin1, point2) { cheers |
Beta Was this translation helpful? Give feedback.
Yes, based on the recomendation of @nzjony I dig arround the projections classes. This solution work for me.
function drawLineBetween(poin1, point2) {
// let zocalo = new GeoCoordinates(19.4326018, -99.1332049);
const currentPosition = mapView.target;
const points = [];
points.push(mapView.projection.projectPoint(poin1));
points.push(mapView.projection.projectPoint(point2));
const geometryl = new THREE.BufferGeometry().setFromPoints(points);
const line = new THREE.Line(geometryl, lineMaterial);
line.anchor = new THREE.Vector3();
mapView.mapAnchors.add(line);
mapView.update();
}
cheers