Getting current map span and center

Hello Syncfusion Team,

I can set the current position with 
(myMap.Layers[0] as ImageryLayer).GeoCoordinates
But how can I get the current position after the map has been panned by a user? GeoCoordinates don't get updated and I can't find any event giving me information about that.

Please advise how I can get the current position.

Best regards
Michael

17 Replies

MP Michael Prabhu M Syncfusion Team August 17, 2018 12:00 PM UTC

Hi Michael, 
 
Greetings from Syncfusion, we have analyzed your requirement and we like to let you know that current behavior of GeoCoordinates property is to view the desired area at the center on loading time. Currently we do not have support to get the current position after panning. So, we have considered your requirement as feature enhancement. This enhancement will provide support to update the GeoCoordinates property even on panning to get the current position. By providing binding to the GeoCoordinates property and the property (user defined) in view model you can get notification about the updated value in the property change of user defined property. 
 
This enhancement will be available in our upcoming Volume 3, 2018 release which is scheduled to be rolled out at the end of September 2018. We appreciate your patience until then. 
 
Thanks, 
Michael 




MP Michael Pusch August 18, 2018 10:25 AM UTC

Hi Michael,

thank you for your reply.

That is good news. It would be great, if you provide the complete visible rectangle and the center, not the center alone!

Thanks,
Michael


MP Michael Prabhu M Syncfusion Team August 20, 2018 10:44 AM UTC

Hi Michael, 
 
We just want to get clarified about your exact requirement on visible rectangle. Hence, we have added simple image below, show casing the bounds of the rectangle in terms of Latitude and Longitude.  
  
 
 
So, can you confirm us whether you need the visible rectangle as stated above, if not please revert us with some more information? This will help us to be on the same page regarding this feature.  
 
Thanks, 
Michael 
  
  
 
 



MP Michael Pusch August 22, 2018 05:56 PM UTC

Hi Michael,

that is exactly what I need, together with events for changing center (panning) and zooming.

Thank you in advance!
Michael


MP Michael Prabhu M Syncfusion Team August 23, 2018 05:32 AM UTC

Hi Michael, 
 
Thanks for the confirmation, as promised earlier this feature will be available in our upcoming Volume 3 2018 release which is scheduled to be rolled out at the end of September 2018.  
 
Thanks, 
Michael 




MP Michael Pusch replied to Michael Prabhu M October 26, 2018 10:10 PM UTC

Hi Michael, 
 
Thanks for the confirmation, as promised earlier this feature will be available in our upcoming Volume 3 2018 release which is scheduled to be rolled out at the end of September 2018.  
 
Thanks, 
Michael 



Hi Michael,

either I don't find it or it has been missed. The actual version is 16.3.0.21, isn't it?

Best regards
Michael


MP Michael Prabhu M Syncfusion Team October 29, 2018 10:26 AM UTC

Hi Michael, 
 
Sorry for the inconvenience caused, yes, the latest Volume 3 release is 16.3.0.21, but we are afraid that we were not able to move the feature into our Volume 3 release due to technical complexity and we needed more time to test this in more scenarios so we have postponed it to Volume 4 release which is expected to be rolled out at the mid of December 2018.  
  
Thanks, 
Michael 




MO Morteza December 22, 2018 10:24 AM UTC

hi
I updated to version 16.4 but the geo coordinate doesn't get updated!


MP Michael Prabhu M Syncfusion Team December 24, 2018 09:33 AM UTC

Hi Morteza, 
  
Greetings from Syncfusion. We have analyzed your query, and prepared sample based on your requirement, and it can be achieved by using GeoCoordinateChanged event, bounds of the rectangle including Center point can be obtained.  
 
We have also prepared a sample based on this and it can be downloaded from the below link, 
  
Screenshot: 
 
Currently we are including User Guide document for GeoCoordinate event and it will be published soon. 
  
Regards, 
Michael 
 



MO Morteza December 30, 2018 01:10 PM UTC

Thanks.
the geocoordinatechanged event work perfect. 
the problem is when we use two way binding with GeoCoordinate it doesn't get updated.
I change my code to use the event.


MP Michael Prabhu M Syncfusion Team December 31, 2018 05:08 AM UTC

Hi Morteza, 
 
Glad we could help, let us know if you need any other assistance from us.  
 
Thanks, 
Michael  




MP Michael Pusch May 19, 2019 08:57 PM UTC

Hello Syncfusion Team, hello Michael and Morteza,

thank you, the new functionality is working fine! 

One thing is missing or I cannot get it to work. This is setting the ImageLayer Geolocation from code behind or data binding to a property. The initialization is working once, but if I try to update it later, it is not working. The Geolocation is updated, but the map does not move to that location. I tried to InvokeOnMainthread and to remove and add the layer, but I can not figure out how to do it correctly. Please advise how to do that.

Thank you 
Michael


BK Bharathiraja K Syncfusion Team May 20, 2019 09:55 AM UTC

Hi Morteza,  
  
GeoCoordinates property is one-way binding property and it will not update the value when you change the center point.  
  
For example, on page loading you set GeoCoordinates (50, 50), then changed the center point on zooming and panning to (20, 30). This value will not update the GeoCoordinates property and its value remains with (50, 50). But after you changed the center point (20, 30) and try to update theGeoCoordinates value (50, 50) in button click, it will not update the Maps. Because the previous and current value GeoCoordinates property is same. To overcome this, we suggest you use the below code.  
   
[C#]:    
   
        private void Button_Clicked(object sender, EventArgs e)   
        {   
            layer.GeoCoordinates = new Point(0, 0);   
            layer.GeoCoordinates = new Point(50, 50);   
        }   
   
   
We hope the given details clears your doubts. If your scenario is different from this, please let us know.   
  
Regards,  
Bharathi. 



MP Michael Pusch May 20, 2019 06:06 PM UTC

Hello Bharathi,

works like a charm!

Thank you!

Best regards
Michael


BK Bharathiraja K Syncfusion Team May 21, 2019 04:55 AM UTC

Hi Michael, 
 
Thanks for your feedback. We are glad that the reported problem resolved at your end. 
 
Regards, 
Bharathi.  



MP Michael Pusch July 7, 2019 10:56 AM UTC

Hello Syncfusion Team,

something is wrong and I don't get if I have a thinking error on my side or if it is a bug on your side. I think the geocoordinationchanged event is mixing latitude and longitude. Please see the attached sample.

Attachment: MapsGeoCoordinate_22634d08.zip


RA Rachel A Syncfusion Team July 8, 2019 12:12 PM UTC

Hi Michael, 
 
We would like to inform you that, in GeoCoordinates(latitude, longitude) property we are setting the latitude value along with longitude value as a geo point. But in GeoCoordinatesChanged event arguments, based on axes (X, Y) orientation we are setting the X as Longitude (Horizontal) and Y as Latitude (Vertical). Please find the below code snippet for your better understanding. 
 
[C#] 
 
public partial class MainPage : ContentPage 
{ 
       const double latitude = 51.509; 
       const double longitude = -0.1180; 
 
       public MainPage() 
       {  
        … 
        ImageryLayer imageryLayer = new ImageryLayer(); 
        imageryLayer.GeoCoordinateChanged += ImageryLayer_GeoCoordinateChanged; 
        imageryLayer.GeoCoordinates = new Point(latitude, longitude); 
        … 
        } 
    } 
 
    private void ImageryLayer_GeoCoordinateChanged(object sender, GeoCoordinateChangedEventArgs e) 
    { 
        var latitude = e.Center.Y; 
        var longitude = e.Center.X; 
   } 
} 
 
So, please do changes at your side in GeoCoordinatesChanged event according to the argument values. 
 
Regards, 
Rachel. 


Loader.
Up arrow icon