0

The Harp example below adds a polygon to a map using screen location and some "unknown" unit of measure. How do I add a polygon based on the lon/Lat of its shape, and its height in meter ?

 //Create the three.js cube
   const geometry = new THREE.BoxGeometry(100, 100, 100);
   const material = new THREE.MeshStandardMaterial({ color: 0x00ff00fe });
   const cube = new THREE.Mesh(geometry, material);
   cube.renderOrder = 100000;

   //Get the position of the click
   const geoPosition = map.getGeoCoordinatesAt(evt.pageX, evt.pageY);
   cube.geoPosition = geoPosition;

   //Add object to the map
   map.mapAnchors.add(cube);
   map.update();

1 Answers1

0

the mapAnchors API is meant for adding three.js objects to the map.

If you want to add a geo-polygon you could either do this via GeoJSON or the FeatureDataSource (which is in fact just a convenience wrapper on top of geojson).

See following examples:

Nino
  • 429
  • 2
  • 8