使用Lon,Lat

问题描述

以下“竖琴”示例使用屏幕位置和某些“未知”度量单位将多边形添加到地图。如何根据多边形的形状/高度和以米为单位的高度添加多边形?

 //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();

解决方法

mapAnchors API用于向地图中添加three.js对象。

如果您要添加地理多边形,则可以通过GeoJSON或FeatureDataSource(实际上只是在geojson之上的便捷包装)来实现。

请参阅以下示例:

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...