I am trying to add a point/line in arcgis map using react JS. Now my map is working fine. I'm referring https://developers.arcgis.com/javascript/latest/add-a-point-line-and-polygon/#run-the-app link. But they are using ARCGIS API for JavaScript for adding points on the map with Graphic and GraphicsLayer. I've followed this method for displaying the map https://www.esri.com/about/newsroom/arcuser/react-arcgis/ I'm trying to add Graphic and Graphics layer module for adding points on the map. Could anyone help me how to add Graphic and GraphicsLayer? Here is my app.js code looks like..
Thank you.
Routing and directions are premium services. You can use an API key with your free developer account.
https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/
HI, @RE I've tried this demo, and I am able to add points on the map. But it is asking me to log in for getting the second point. Is there any way to display the route and directions without login?
That demo is really old. The concepts from that blog post still apply. I don't recommend mixing JSAPI imports in React components, but using some sort of layer between the API and your components. Whether that is Context or some other state management.
Here is a more up-to-date demo of using the latest ESM build of the JSAPI with React. It includes a way to add graphics to the map.
https://github.com/odoe/jsapi-esm-react
I'm following this project https://github.com/odoe/jsapi-react
There's a number of ways to use the JSAPI with React. Do you have a sample project to look at? Is it class based? Hooks? Importing API in the Component? In Context? Could be a number of issues related to component state or hooks loops.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.