I can't get a 3D point to show up in my web scene

891
3
Jump to solution
06-26-2019 05:41 PM
benjaminfriedman
New Contributor

Hi all, 

New to the ArcGIS JS Api and JS overall. I am having a problem visualizing a point in a scene. I have the scene working and I don't get any errors, but the point I am creating is not visable. 

Here is the code I am using: 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>ArcGISTest</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/SceneView",
"esri/Graphic",
"esri/layers/GraphicsLayer"
], function(Map, SceneView, Graphic, GraphicsLayer) {

var map = new Map({
basemap: "topo-vector",
ground: "world-elevation" // show elevation
});

var view = new SceneView({
container: "viewDiv",
map: map,
camera: {
position: { // observation point
x: -118.71,
y: 33.75,
z: 25000 // altitude in meters
},
tilt: 65 // perspective in degrees
}
});

//*****Add Graphics Layer******
var graphicsLayer = new GraphicsLayer();
map.add(graphicsLayer);
//*****Add a 3D Point graphic****

//DTLA
var point = {
type: "point", //autocasts as new Point()
x: -118.255113,
Y: 34.042281,
z: 1010
};

markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40],
outline: {
// autocasts as new SimpleLineSymbol()
color: [255, 255, 255],
width: 2
}
};

var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
})

graphicsLayer.add(pointGraphic);




});
</script>

</head>
<body>
<div id="viewDiv"></div>
</body>
</html>

But this is what my webpage looks like 

Seems like there is no point!! I looked around for it too in case the lat-long got messed up. 

Any help would be greatly appreciated! 

Thanks

Tags (4)
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

Remember, case counts in Javascript!

You're using an uppercase Y when constructing the point. It has to be

var point = {
  type: "point", //autocasts as new Point()
  x: -118.255113,
  y: 34.042281,
  z: 1010
};‍‍‍‍‍‍‍‍‍‍‍‍

Get in the habit of looking at the console. It was reporting

[esri.views.3d.layers.graphics.Graphics3DSymbolLayer] point coordinate is not a valid number, graphic skipped

View solution in original post

3 Replies
KenBuja
MVP Esteemed Contributor

Remember, case counts in Javascript!

You're using an uppercase Y when constructing the point. It has to be

var point = {
  type: "point", //autocasts as new Point()
  x: -118.255113,
  y: 34.042281,
  z: 1010
};‍‍‍‍‍‍‍‍‍‍‍‍

Get in the habit of looking at the console. It was reporting

[esri.views.3d.layers.graphics.Graphics3DSymbolLayer] point coordinate is not a valid number, graphic skipped

benjaminfriedman
New Contributor

Ahh!! Thanks so much Ken. I really appreciate it. It worked haha.

0 Kudos
KenBuja
MVP Esteemed Contributor

Glad to help. Please click the Mark Correct button

0 Kudos