提问人:Ahmad Habibi 提问时间:10/13/2023 更新时间:10/13/2023 访问量:31
如何使用 Cesium.js 和 Google Map API 单击建筑物/地形时获取海拔
How to get elevation when click on building/terrain with Cesium.js and Google Map API
问:
目前,我通过单击自动完成搜索输入来获得提升。
async function searchByAddressHandler( place_id ) {
await geocoder
.geocode( {placeId: place_id} )
.then( async ( {results} ) => {
if( results[ 0 ] ) {
const elevationResponse = await elevationService.getElevationForLocations( {
locations: [results[ 0 ].geometry.location],
} );
if( !(elevationResponse.results && elevationResponse.results.length) ) {
useGrowl( 'error', `Insufficient elevation data for place: ${results[ 0 ].formatted_address}` )
}
const elv = elevationResponse.results[ 0 ].elevation;
elevation = elv;
resolution = elevationResponse.results[ 0 ].resolution
rotateCameraAround(
results[ 0 ].geometry.location,
results[ 0 ].geometry.viewport,
elv
);
} else {
useGrowl( 'error', 'No result found' );
}
} ).catch( ( e ) => {
useGrowl( 'error', `Geocoder failed due to: ${e}` );
} );
autocompleteLists = [];
showAutoCompleteList = false;
}
有没有办法通过点击Cesium.js中的建筑物或地形来获得高程?
答: 暂无答案
评论