Xamarin.forms.googlemaps: Add Map.InitialCameraUpdate property

Created on 1 Feb 2017  路  7Comments  路  Source: amay077/Xamarin.Forms.GoogleMaps

FEATURE REQUEST / SUGGESTION

SUMMARY

Set maps initial location easily.

DETAILS

Now, initial location is Rome when page shown.
If change to other location then should call MoveToRegion in page constructor.

My suggestion is make Map.InitialCameraPosition as CameraPosition what is bindable property provides set initial location easily.

In code

class MyPage : Page {
  MyPage() {
    InitializeComponents();

    map.InitialCameraUpdate = CameraUpdateFactory.NewCameraPosition(new CameraPosition(
      new Position(34, 135),  // latlng
      14d, // zoom
      30d, // rotation
      60d)); // tilt
  }
}

In XAML

<maps:Map
    InitialCameraUpdate="34, 135, 14, 30, 60"   <-- direct setting by TypeConverter
    VerticalOptions="FillAndExpand" />

OR

<maps:Map
    InitialCameraUpdate="{Binding FirstCameraUpdate}"  <-- binding to ViewModel
    VerticalOptions="FillAndExpand" />

RELATED ISSUES

  • #101

PLATFORMS

which platform do you want?

  • [x] Android
  • [x] iOS
  • [x] UWP
bug enhancement

All 7 comments

@amay077
I am seeing the same error and I just updated to 2.1.0, if I remove the InitialCameraUpdate in Xaml the view no longer crashes.

yes the same is here
when i remove the camera from xaml it works

Thanks @kevincraig , @abdoelzamalkawy ,
Maybe I should change CameraUpdateConverter accessibility to public.

What about this problem ? Any solution ? I am getting Rome as the initial place and I need to initiate my map in my position, and not move from Rome to it... Everytime I start a new map, it shows Rome and after that, moves to my position.

Sorry guys, I still can't understand how this is possible.
It is exactly what I need too:

<maps:Map
    InitialCameraUpdate="{Binding FirstCameraUpdate}"  <-- binding to ViewModel
    VerticalOptions="FillAndExpand" />
Was this page helpful?
0 / 5 - 0 ratings

Related issues

soile1991 picture soile1991  路  5Comments

PeterRT picture PeterRT  路  7Comments

ViktorBylbas picture ViktorBylbas  路  4Comments

talhaa91 picture talhaa91  路  4Comments

idan-rubin picture idan-rubin  路  6Comments