Skip to content

Comparison with Xamarin.Forms.Maps

amay077 edited this page Jul 3, 2016 · 6 revisions

Explain about comparison with Xamarin.Form.Maps. Unless otherwise noted, these are supported for Android and iOS onkly.

INDEX


Added Features

Polyline, Polygon, Circle supports(v1.1.0-)

Can drawing Polyline, Polygon and Circle by common API.

Polyline, Polygon, Circle supports

For example, you can add a polyline as follows.

// map as Xamarin.Forms.GoogleMaps.Map

var polyline = new Polyline();
polyline.Positions.Add(new Position(40.77d, -73.93d));
polyline.Positions.Add(new Position(40.81d, -73.91d));
polyline.Positions.Add(new Position(40.83d, -73.87d));

polyline.StrokeColor = Color.Blue;
polyline.StrokeWidth = 5f;
polyline.Tag = "POLYLINE"; // Can set any object

polyline.IsClickable = true;
polyline.Clicked += (s, e) => 
{
    // handle click polyline
};

map.Polylines.Add(polyline);

You can delete a polyline as follows.

map.Polylines.Remove(polyline);

In polyline or polygon, if you set IsClickable to true then you can subscribe Clicked events.

Circle have not IsClickable property and Clicked events. Because Android native Google Maps API does not support circle clicking.

For more information, refer to ShapesPage.xaml.cs in SampleApp - XFGoogleMapSample.

Limitations

  • In v1.1.0, Pin, Polyline, Polygon and Circle's each properties does not support binding.

Select or unselect pin to programmatically(v1.0.0-)

You can set pin to Map.SelectedPin, then show info-window and pin marks "selected". Set null to Map.SelectedPin, then close info-window and pin marks "unselected".

For more information, refer to PinsPage.xaml.cs in SampleApp - XFGoogleMapSample.

Pin selection event(v1.2.0-)

Raise Map.SelectedPinChanged event when pin selected.

This event occur when tap pin yourself or set Map.SelectedPin property. If unselected, SelectedPinChangedEventArgs.SelectedPin to be null.

map.SelectedPinChanged += (object sender, SelectedPinChangedEventArgs e) =>
{
    labelStatus.Text = $"SelectedPin changed - {e?.SelectedPin?.Label ?? "nothing"}";
}

Custom tile support(v1.3.0-)

Add TileLayer object to Map.TileLayers, you can display original map tiles.

Custom tile supports

For example, you can display the GSI Maps as follows.

var tileLayer = TileLayer.FromTileUri((int x, int y, int zoom) => 
    new Uri($"https://cyberjapandata.gsi.go.jp/xyz/std/{zoom}/{x}/{y}.png")
);
map.TileLayers.Add(tileLayer);

If you want return image directory, you can use TileLayer.FromSyncImage または TileLayer.FromAsyncImage .

For more information, refer to TilesPage.xaml.cs in SampleApp - XFGoogleMapSample.

Changed Features

Add bool animation parameter to Map.MoveToRegion method(from v1.1.0)(Support Android / iOS / UWP)

Set animate parameter to true, then animation when map panning. set to false, then panning directly. This is optional parameter, default is true.

Deleted Features

  • (-v1.3.0)
Clone this wiki locally