Select to view content in your preferred language

Migrating from Google Maps

10-25-2021 10:29 PM
New Contributor

Hello community!

We are migrating our Google Maps based web application over to Esri. Our application shows locations updating on the screen.

With google maps you can use the setPosition method on a marker to move the marker position. I have not found something similar within Esri. Would I have to clear my graphic and create a new one in place of it? I'm trying to think of a way to show several different locations updating without having to redraw each graphic.

Any help is appreciated!

0 Kudos
3 Replies
Frequent Contributor II

You can update the geometry of the graphic directly like in this demo.

view.on("click", ({ mapPoint }) => {
	graphic.geometry = mapPoint;
0 Kudos
Esri Regular Contributor

Are you using a GraphicsLayer, or a FeatureLayer defined with client-side Graphics?  Here's a simple CodePen that shows how to apply client-side updates to either one:


0 Kudos
Esri Contributor

There are huge huge differences in terms of how Google maps works compared to ESRI and if you're searching a direct "translation" of the functionality you had in Google into ESRI then you're looking at it wrong. Just like you can't translate every sentence directly from one language to another (might not be the best analogy).

If you'd like to achieve the functionality of dragging a point over the map to update it's location, you need to understand the fundamentals of ESRI and how to publish editable layers, which then gives you this functionality out-of-the-box. The answers you received here are just workarounds to try and mimic that behaviour based on what you already know from Google, which is very wrong in my opinion. A new product requires a new approach and different (better) solutions.

0 Kudos