Xamarin.forms.googlemaps: Why custom pin icon in iOS bigger than Android?

Created on 16 Jul 2016  ·  9Comments  ·  Source: amay077/Xamarin.Forms.GoogleMaps

I use BitmapDescriptorFactory.FromBundle or BitmapDescriptorFactory.FromStream in custom pin icon.
This is same image size but iOS pin icon size is bigger than Android.

2016-07-14 03 10 25

I don't know why such a happen.
This is not Xamarin.Forms.GoogleMaps's problem, because it does not process source image.

I wonder what is due?

  • Google Maps SDK for iOS's design?
  • Related on Retina display?
  • iOS side is correct, Android side is wrong?
  • "@2x" image can solves this?
  • Resources.DisplayMetrics can solves this?

Any ideas?

enhancement

All 9 comments

I just read about a similar problem on the "TK.CustomMap" component: "Custom pin icon looks large and blury on iOS". (See https://github.com/TorbenK/TK.CustomMap/issues/100 .)

From https://github.com/TorbenK/TK.CustomMap/issues/100#issuecomment-230470781 , in their case the problem seems to be due to using a StreamImageSource; since in that case there is no @2x file name, UIImage cannot guess the proper size.

素晴らしいライブラリをありがとうございます。

UIImage.LoadFromDataには、第二引数でscaleを指定することが可能です。

BitmapDescriptorExtensions.ToUIImageで

UIImage.LoadFromData(NSData.FromStream(self.Stream), UIScreen.MainScreen.Scale);

手元ではこれでうまくいっているように見えます。
(iOSのバージョンなどで縛りがあるかもしれません)

別件で気になっているのは、これでマーカーをたくさん作ると、同一ストリームを指定してもメモリを大量に消費しないか?ということです。

Solution suggested by @jungoross is working.
As a workaround I am overwritng Icon property on Pin.NativeObject using the above method, but @amay077 could you please include the above fix in your next release?

Thank you in advance

I can't undestand @jungoross response because its in Japanese, could be translated?

I released 2.3.0-beta1 than includes fix this issue.

@jungoross さん、返事が遅くなってすみません。
貴方が提案していただいた修正を適用して大丈夫そうだったので v2.3.0-beta1 に組み込みました。

BitmapDescriptorType.Bundle の方も同じ問題があったので、同じように修正しています。
リサイズの為にメモリを消費しそうなのはその通りだと思いますが、仕方ないですね。

ご対応ありがとうございました。小まめなアップデートのご尽力に大変感謝しております。

I still have the same problem although I have instaled the 3.3.0 version in my project, any suggestion?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

talhaa91 picture talhaa91  ·  4Comments

mtsrdr picture mtsrdr  ·  6Comments

idan-rubin picture idan-rubin  ·  6Comments

Gavrielo picture Gavrielo  ·  3Comments

amay077 picture amay077  ·  7Comments