Select to view content in your preferred language

How to make graphic not moving when drag the map?

1245
2
Jump to solution
08-05-2021 11:51 PM
howard
by
Emerging Contributor

Hi,

I have a question, I use SketchViewModel to draw the shape on map, I want to keep the shape located in center (not moving) when the map is moving by pan or drag; how can I implement it?  

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
CourtneyMenikheim
Frequent Contributor

Get the extent of the map.
Pick a corner of the map and store it in a variable (startingPoint).

Listen for the map to move. When it does, get the new extent.
Check the change from startingPoint to the new extent. (Ex. +3 degrees lat, -2 long)

Get the geometry of the shape you drew.
Loop through each point on the shape and adjust the coordinates by the same amount the startingPoint shifted.

Courtney Menikheim

View solution in original post

2 Replies
CourtneyMenikheim
Frequent Contributor

Get the extent of the map.
Pick a corner of the map and store it in a variable (startingPoint).

Listen for the map to move. When it does, get the new extent.
Check the change from startingPoint to the new extent. (Ex. +3 degrees lat, -2 long)

Get the geometry of the shape you drew.
Loop through each point on the shape and adjust the coordinates by the same amount the startingPoint shifted.

Courtney Menikheim
howard
by
Emerging Contributor

Thanks! Good solution.