I am working to create a React App, and am currently using “Resium,” in VS Code.
I have been able to return the “Viewer,” on the screen, but I want to make it more interactive with the user. I looked through what was offered on sandcastle and other online sources, but I am only able to find the option to “draw a line,” or “draw a polygon,” and the “picking” option, which shows lat long of wherever my mouse hovers.
I am looking for a kind of “in between” feature, or guidance on how I can achieve this end goal. I would like to be able to click on the globe and create a point. I would then like to be able to return the latitude and longitude of that point.
I hope to hear back soon.
Thank you again!
Cheers, Divya
With your permission, I would like to make this post public. I do not see any confidential information on your post and I think that this post would help out the rest of our community. Do I have your permission to make this post public? Let me know, and we can start taking a look at your use-case
I would use the method setInputAction() of ScreenSpaceEventHandler to add a point to the map when the user left-clicks. Here is some documentation to get you started:
Thus you will need the mouse position to add a point to the viewer. The picking sandcastle demo shows how to get the cartographic of the mouse at any given time. Lines 46-51 seem particularly important. Once acquired, these values can easily be printed to the Console.
Let me know if you have any other questions or concerns. I would also be curious to hear other ideas for implementing this functionality.
That’s a great question. I would recommend going through the “getting started” resources on Resium’s website. These guides should help get you familiar with Resium. A basic familiarity with Resium will make the whole development process more seamless.
Hey Sam, I implemented a clicking point which is returning a Cartesian 2 (x,y) points. I notice that this is not matching the lat and long coordinates on the map. Do you know why this may be the case/ and what exactly Cartesian is returning?
Thank you for the update! How exactly are you generating the Cartesian points? Is it possible that you need to convert these coordinates to degrees to get the expected location?