I'm using Javascript api 4.31 and am getting Property 'geometry' does not exist error when trying to create a graphic from a point. My code is this:
//values of x and y are: x=-13091490.173999999, y=4013255.786700003
let pt = new Point({
x:x,
y:y,
spatialReference: this.sr//this is valid wkid=3857
});
let ptGraphic = new Graphic({
geometry: pt.geometry, //error here is: Property 'geometry' does not exist on type 'Point'
});
Any idea why I get this error, or if there is another way to do this? My code is based on an example of making graphic from point located at:
// First create a point geometry
let point = {
type: "point", // autocasts as new Point()
longitude: -71.2643,
latitude: 42.0909
};
// Create a symbol for drawing the point
let markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40]
};
// Create a graphic and add the geometry and symbol to it
let pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});I'm seeing the same error if I try to run the example code.
Thanks
Pete