Select to view content in your preferred language

Rendering a point is not working for WebMap

134
1
Jump to solution
a month ago
JoelCabreraRendón
New Contributor

Hello. I'm trying to render a saved location(using a point graphic) into a web map. But it is not working. The point is never rendered. 

I tried following the guide at https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=intro-graphics with no success. I also tried using the react components. 

See https://codepen.io/Joel-Cabrera/pen/bGyvMKO for an example of that. 

0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor II

If you wrap most of your code in a view.when, you can use the views spatial reference to create your point.

 const point = new Point({
    x: -9810308.361037346,
    y: 5136801.597252877,
    spatialReference: view.spatialReference
});

The default spatial reference of geometries is WGS84, so you need to specify when using something else. 

View solution in original post

1 Reply
ReneRubalcava
Frequent Contributor II

If you wrap most of your code in a view.when, you can use the views spatial reference to create your point.

 const point = new Point({
    x: -9810308.361037346,
    y: 5136801.597252877,
    spatialReference: view.spatialReference
});

The default spatial reference of geometries is WGS84, so you need to specify when using something else.