无法在 ArcGIS 中获取位置、3D 成像或航向(方向)
can't get location, 3D imaging or heading (direction) in ArcGIS
我是 arcgis 的新手。我试图在 3D 中以特定角度显示特定位置。地点是宾夕法尼亚州麦基斯波特的水街和第五大道的拐角处。角度朝东。倾斜度为 45。但这就是我得到的结果:https://codepen.io/lschneiderman/pen/ZEQEWXG
我的代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ArcGIS JavaScript Tutorials: Create a JavaScript starter app</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.15/"></script>
</head>
<body>
<div id="viewDiv"></div>
<script>
require([
"esri/Map",
"esri/views/SceneView"
], function(Map, SceneView) {
var map = new Map({
basemap: "topo-vector",
ground: "world-elevation" // show elevation
});
var view = new SceneView({
container: "viewDiv",
map: map,
heading: 90,
camera: {
position: { // observation point
latitude: '40.350500',
longitude: '-79.868870',
z: 1000 // altitude in meters
},
tilt: 45 // perspective in degrees
}
});
});
</script>
</body>
</html>
确保在 camera
对象上设置观察方向的航向(角度)。这将使相机朝东,位于十字路口上方
var view = new SceneView({
container: "viewDiv",
map: map,
camera: {
position: {
// observation point
latitude: "40.350500",
longitude: "-79.868870",
z: 700 // altitude in meters// altitude in meters
},
heading: 90,
tilt: 45 // perspective in degrees
}
});
这是修改后的 CodePen 的 link:https://codepen.io/arnofiva/pen/688eee67141131712a12ccc3310a6ea4?editors=1010
如果要让摄像头看向路口,需要将摄像头向东移动来采用位置,例如:
latitude: "40.350464",
longitude: "-79.874628",
这是另一个版本的 CodePen,显示了相机视野中的交叉点:
https://codepen.io/arnofiva/pen/a2da1acb4cba398721690bf4d0b2101a?editors=0010
与其手动设置这些值,使用 SceneView.goTo()
并将您希望它关注的点作为参数传递可能更容易:
var view = new SceneView({
container: "viewDiv",
map: map
});
view.goTo({
target: [-79.86887, 40.3505], // coordinates of crossing
heading: 90,
tilt: 45,
zoom: 18 // instead of a z-value, we provide the zoom level
}, {
duration: 0 // tell view not to animate camera movement
});
这是显示 goTo()
用法的 CodePen:https://codepen.io/arnofiva/pen/e91dd1b257a002a0c4d007d3724e039f?editors=1010
我是 arcgis 的新手。我试图在 3D 中以特定角度显示特定位置。地点是宾夕法尼亚州麦基斯波特的水街和第五大道的拐角处。角度朝东。倾斜度为 45。但这就是我得到的结果:https://codepen.io/lschneiderman/pen/ZEQEWXG
我的代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ArcGIS JavaScript Tutorials: Create a JavaScript starter app</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.15/"></script>
</head>
<body>
<div id="viewDiv"></div>
<script>
require([
"esri/Map",
"esri/views/SceneView"
], function(Map, SceneView) {
var map = new Map({
basemap: "topo-vector",
ground: "world-elevation" // show elevation
});
var view = new SceneView({
container: "viewDiv",
map: map,
heading: 90,
camera: {
position: { // observation point
latitude: '40.350500',
longitude: '-79.868870',
z: 1000 // altitude in meters
},
tilt: 45 // perspective in degrees
}
});
});
</script>
</body>
</html>
确保在 camera
对象上设置观察方向的航向(角度)。这将使相机朝东,位于十字路口上方
var view = new SceneView({
container: "viewDiv",
map: map,
camera: {
position: {
// observation point
latitude: "40.350500",
longitude: "-79.868870",
z: 700 // altitude in meters// altitude in meters
},
heading: 90,
tilt: 45 // perspective in degrees
}
});
这是修改后的 CodePen 的 link:https://codepen.io/arnofiva/pen/688eee67141131712a12ccc3310a6ea4?editors=1010
如果要让摄像头看向路口,需要将摄像头向东移动来采用位置,例如:
latitude: "40.350464",
longitude: "-79.874628",
这是另一个版本的 CodePen,显示了相机视野中的交叉点: https://codepen.io/arnofiva/pen/a2da1acb4cba398721690bf4d0b2101a?editors=0010
与其手动设置这些值,使用 SceneView.goTo()
并将您希望它关注的点作为参数传递可能更容易:
var view = new SceneView({
container: "viewDiv",
map: map
});
view.goTo({
target: [-79.86887, 40.3505], // coordinates of crossing
heading: 90,
tilt: 45,
zoom: 18 // instead of a z-value, we provide the zoom level
}, {
duration: 0 // tell view not to animate camera movement
});
这是显示 goTo()
用法的 CodePen:https://codepen.io/arnofiva/pen/e91dd1b257a002a0c4d007d3724e039f?editors=1010