Is there any way to either move a marker or drop a new marker on SfMaps?
So what we are looking for is ideally bound updating of marker co-ordinates (when a user drags a marker), or if that's not possible, events that could be picked up on when a marker is moved, so programatically could set data point location. And finally, picking up on a map click to drop a marker, and obtain the corresponding GPS co-ordinates for.
Is any of this possible, or planned? I did see a reference somewhere that this, or something like this was to be in Jan 2019 release, but can't see it.
We have implemented the “Get Latitude and Longitude coordinates of Markers based on point and vice versa” feature and included in our latest Beta version (17.10.32).
Please find the below details for more information about the feature.
SfMaps offers two utility methods to transform the pixel values to longitude and latitude values and vice-versa. This method is used for both ShapeFileLayer and ImageryLayer.
GeopointToViewPoint(double latitude, double longitude) - Converts the latitude and longitude values to screen point. Here, pass the parameters as latitude and longitude values, from that values we can get screen points x and y.
GetLatLonFromPoint(Point point) - Converts the screen point to longitude and latitude values. Here, pass the parameters as screen points x and y, from that points we can get longitude (Point.X) and latitude (Point.Y) values.
We have prepared the sample. Please find the sample from the following location.
Note: Select theInclude prereleasecheckbox in Package Manager Solution to download our latest Beta version NuGet packages.
PHPhil HolmesMarch 28, 2019 12:11 AM
That sounds like it would help, but still not get me there. The MarkerSelected event would let me pick up when a pin is selected, but I can't see how that would give me any access to when the marker is then dragged somewhere else, or if the user clicks somewhere on the map to drop a pin. Remember, what I am trying to do here is let the user mark where a pin should go on the map.
I can see that if I did have this, then the Query 2 part of your response would let me convert the pixel coordinates to LatLon co-ordinates.
Am I missing something here, or is there some way to do the "Set Pin Location" function?
BKBharathiraja K Syncfusion Team March 29, 2019 07:29 AM
Thanks for the patience.
We have achieved your requirement as a workaround sample by using the touch events. We have added the markers in the touch down event. Please find the sample from the following location.
Query 2: Convert the pixel coordinates to LatLon co-ordinates.
You have to give a screen point / touch point of the layer in the GetLatLonFromPoint (Pointpoint) method to convert the touch point to corresponding Latitude and Longitude points.
PHPhil HolmesApril 1, 2019 01:18 AM
That code does seem to be doing what I need. I notice you are doing the marker creation in the platform-specific Custom Renderers, so I assume these markers are also then available for programatic access back in the PCL code. I will try adopting this technique & let you know if it proves out all OK.
I understand this functionality is currently in beta release, which I am reluctant to release to our production. Do you have an estimate of when this will go stable release?
BKBharathiraja K Syncfusion Team April 1, 2019 01:53 AM
Query 1: I notice you are doing the marker creation in the platform-specific Custom Renderers, so I assume these markers are also then available for programmatic access back in the PCL code
We have used platform-specific Custom Renderers only to get the touch point. After receiving the touch point across the three platform, we will pass this to PCL project and will create Markers in PCL project itself.
Query 2: Do you have an estimate of when this will go stable release?
We are glad to announce that our Essential Studio 2019 Volume 1 release (v18.104.22.168) is rolled out and is available for download under the following link.
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.
PHPhil HolmesApril 5, 2019 02:00 AM
Unfortunately I can't proceed with this just yet, as that release (v22.214.171.124) has some issues. Sorry I can't be more specific, but after updating my Syncfusion libraries to this version, my pre-existing, working project is fairly regularly dropping out. And after spending 1.5 days on it so far, difficult to trace the specific problem, as it does seem to be library problems. App works 100% with v16, not v17.
I will monitor for an update to this, hoping you otherwise find the new problems with v126.96.36.199.
BKBharathiraja K Syncfusion Team April 5, 2019 05:23 AM
We don’t face any problem with our latest version 188.8.131.52 version from our customer right now. So, if you face any issues, please share the crash log report, replication steps or any other details. We will investigate and provide you solution.
RArameezAugust 27, 2021 07:27 AM
How can we move the selected marker or set location in MVVM structure-based project
ETEswaran Thirugnanasambandam Syncfusion Team August 30, 2021 06:16 AM
Greetings from Syncfusion.
Currently we don’t have support to drag or move the marker added on SfMaps. We have already logged a feature request for this requirement “Drag and drop support for markers in SfMaps” and it can be tracked through our feedback portal below.
Please cast your vote to make it count. We will prioritize the features every release based on the demands, and we do not have immediate plan to implement this feature since we committed with already planned work. So, this feature will be available any of our upcoming release.
If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal.