Xamarin.forms.googlemaps: Adding SetMinMaxZoom() API to PCL

Created on 12 Jun 2017  路  6Comments  路  Source: amay077/Xamarin.Forms.GoogleMaps

First of all I wanted to extend a huge THANK YOU for building this amazing package! It greatly reduces our custom native code and simplifies app.

Since both iOS and Android support min and max zoom for the map, can you please add it to the PCL?

which platform do you want?

  • [x] Android
  • [x] iOS
enhancement welcomecontribute

Most helpful comment

I suggest adding listed APIs in Xamarin.Forms.GoogleMaps.

  • Map.SetMinMaxZoomLevel(float minZoomLevel, float maxZoomLevel) method
  • Map.MinZoomLevel property (getter only)
  • Map.MaxZoomLevel property (getter only)

Why Map.MinZoom doesn't have the setter?
Because separated setter and getter to each methods in GoogleMaps Android API(setMaxZoomPreference and getMinZoomLevel).

But this implementations are very easy.
Is there somebody who can try?

All 6 comments

Yes we can, I found set min/max zoom-level in Android and iOS Google Maps API.

I suggest adding listed APIs in Xamarin.Forms.GoogleMaps.

  • Map.SetMinMaxZoomLevel(float minZoomLevel, float maxZoomLevel) method
  • Map.MinZoomLevel property (getter only)
  • Map.MaxZoomLevel property (getter only)

Why Map.MinZoom doesn't have the setter?
Because separated setter and getter to each methods in GoogleMaps Android API(setMaxZoomPreference and getMinZoomLevel).

But this implementations are very easy.
Is there somebody who can try?

@amay077 Have you implemented this Zoom Level setter properties.

Any one has implemented this I need to add this in my project

I have fixed this using customising maps CameraChanged method
googleMap.CameraChanged += async (object sender, CameraChangedEventArgs e) => await GoogleMap_CameraChanged(sender,e) ;

async Task GoogleMap_CameraChanged(object sender, CameraChangedEventArgs e) { if(e.Position.Zoom>maxZoom){ CameraPosition cameraPosition = new CameraPosition(e.Position.Target, maxZoom); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); googleMap.InitialCameraUpdate = cameraUpdate; await googleMap.AnimateCamera(cameraUpdate); } if (e.Position.Zoom <minZoom ) { CameraPosition cameraPosition = new CameraPosition(e.Position.Target, minZoom); CameraUpdate cameraUpdate = CameraUpdateFactory.NewCameraPosition(cameraPosition); googleMap.InitialCameraUpdate = cameraUpdate; await googleMap.AnimateCamera(cameraUpdate); } }

This feature would be really handy to have in this library

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amay077 picture amay077  路  4Comments

LukasThijs picture LukasThijs  路  7Comments

JKennedy24 picture JKennedy24  路  6Comments

goodguy010 picture goodguy010  路  5Comments

mtsrdr picture mtsrdr  路  6Comments