We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

need GoogleMap Type street using SfMaps

Hi,
I need google map api type street using SfMaps 
Please help

Regards,
Yogita

6 Replies

RS Ramya Soundar Rajan Syncfusion Team January 28, 2020 11:57 AM UTC

Hi Yogitha, 
 
You can add google maps in SfMaps control. Please refer the following Kb. 
 
 
Please find the following UG link for more information. 
 
 
Regards, 
Ramya 
  



YO Yogita January 29, 2020 06:06 AM UTC

Hi Ramya
 I have already used this Api I need Api for Google Street Map
Like Normal Xamarin Forms maps or Native map please provide ur support.

Regards,

Yogita


RS Ramya Soundar Rajan Syncfusion Team January 30, 2020 10:39 AM UTC

Hi Yogita, 
 
To display the google street map view, you can assign the given google map Url of “lyrs” value is “m” as shown in below code. 
 
        private void ImageryLayer_RequestTileUri(object sender, Syncfusion.SfMaps.XForms.TileUriArgs e) 
        { 
            var link = "http://mt1.google.com/vt/lyrs=m&x=" + e.X.ToString() + "&y=" + e.Y.ToString() + "&z=" + e.ZoomLevel.ToString(); 
            e.Uri = link;          
        } 
 
Likewise, you can change to the other view type by assigning the below layer value. 
  
h = roads only 
m = standard roadmap (street map) 
p = terrain 
r = somehow altered roadmap 
s = satellite only 
t = terrain only 
y = hybrid 
  
Please find the sample link from below location. 
  
  
Output Screenshot: 
  
   
 
Regards, 
Ramya. 



YO Yogita February 3, 2020 06:17 AM UTC

thanks Ramya


YO Yogita February 3, 2020 10:12 AM UTC

Hi Ramya ,

thanks for your support I need one more help 
I have multi pin plotted when I click on button which placed over the map 
OnButtonClick even I should be. able to zoom or focus only on that pin whose lat and long I have given 


Can we have MapSpan or Camerafactory like we have in Xamarin Maps
Move to Region Property

Kindly help me out .

Regards,
Yogita


VR Vignesh Ramesh Syncfusion Team February 4, 2020 11:22 AM UTC

Hi Yogita, 

Thanks for your response. 

Currently SfMaps does not have direct support to achieve your requirement. So, we have achieved this requirement in sample level by calculating the bounds of the Markers collection. From that Marker bounds, calculated the center, ZoomLevel values and set those values to GeoCoordinate and ZoomLevel property of SfMap. Please find the snippet from below. 

[C#]: 
… 
private void AddMarkersButton_OnClicked(object sender, EventArgs e) 
{ 
    this.AddMarker(); 
} 
… 
private void AddMarker() 
{ 
    this.imageryLayer.Markers.Add(new CustomMarker { Latitude = "22.787998", Longitude = "72.539067" }); 
    this.imageryLayer.Markers.Add(new CustomMarker { Latitude = "22.589499", Longitude = "75.842287" }); 
    this.imageryLayer.Markers.Add(new CustomMarker { Latitude = "22.122114", Longitude = "85.158694" }); 
    this.imageryLayer.Markers.Add(new CustomMarker { Latitude = "17.213389", Longitude = "78.457033" }); 
    this.imageryLayer.Markers.Add(new CustomMarker { Latitude = "10.259969", Longitude = "77.512209" }); 
 
    this.CalculateZoomLevel(this.imageryLayer.Markers); 
} 
… 
// Calculate the ZoomLevel based on the Markers collection. 
private void CalculateZoomLevel(ObservableCollection<MapMarker> markers) 
{ 
    CalculateMarkerBounds(markers, out Point northEast, out Point southWest); 
    var center = new Point((northEast.Y + southWest.Y) / 2, (northEast.X + southWest.X) / 2); 
    var northEastWithPadding = new Point(northEast.X + ((northEast.X - center.X) / 2), northEast.Y + (northEast.Y - center.Y) / 2); // added half distance as padding for north east 
    var southWestWithPadding = new Point(southWest.X - (center.X - southWest.X) / 2, southWest.Y - (center.Y - southWest.Y) / 2); // added half distance as padding for south west 
    var zoomLevel = GetBoundsZoomLevel(northEastWithPadding, southWestWithPadding, sfMaps.Width, sfMaps.Height); 
 
    if (this.sfMaps.ZoomLevel == zoomLevel) 
    { 
        this.sfMaps.ZoomLevel = 1; // reset the zoom level value in order to update the property 
    } 
 
    sfMaps.ZoomLevel = zoomLevel; 
 
    if (imageryLayer.GeoCoordinates == center) 
    { 
        this.imageryLayer.GeoCoordinates = new Point(0, 0); // reset the center value in order to update the property 
    } 
 
    imageryLayer.GeoCoordinates = center; 
}… 

Please find the sample from the below location. 

Already, we have logged feature request for the above requirement, and you can track from the below feedback report link.   


It will be available in our upcoming volume 2020 Volume 1 release which is scheduled to be rolled out by March 2020. We appreciate your patience until then.  

Please continue with the above workaround until our 2020 volume 1 release. 

Regards, 
Vignesh.

Loader.
Live Chat Icon For mobile
Up arrow icon