Hi,
The points are not getting plotted even though the data is coming form the calling API. I am trying to plot the points based on the latitude and longitude coming via an API. I can see the data in the console but its not getting plotted while calling this function.
PFB the code snippet:
what does your addGraphic method look like?
sorry forgot to add that
Hard to tell what is going on; do you have a very simple codepen (or similar) so we can experience the issue? My guess is that maybe the result.lng and result.lat values are strings instead of numbers, or maybe the values represent X and Y instead of longitude and latitude?
I did the same thing in react application and its working fine over there with the same code.
This is what i am getting in my console.
add an attribute to your graphic, even if it's an empty object, that might fix it. new Graphic({attributes: {}, geometry});
I added the attributes to the graphic function but still its not plotting the points.
Can anyone please help me here!
Hard to tell what is going on; do you have a very simple codepen (or similar) so we can experience the issue?
Not sure, but in the screenshot the lat/lon values display as strings, so maybe try converting them to numbers?
example: Number(result.lng)