When the list of pins is too long, the app lock. For instance, I have a Collection of Pins "A" that has 500 elements on list... works normally. Another Collection of Pins "B" has almost 5.000 pins. The app lock when start to Add the pins. Nothing happens. Any exception or error...just frozen.
All the pins on the map.
Pin pinOndeTemTiro = new Pin()
{
Type = PinType.Place,
Icon = BitmapDescriptorFactory.FromBundle("ondetemtiro.png")
};
mylist = t.Result;
for (int index = 0; index < mylist.Count; index++)
{
try
{
var item = mylist[index];
var obj = item.latlng;
var LATLONG = JsonConvert.DeserializeObject<LatLong>(obj);
mylist[index].Latlong = LATLONG;
pinOndeTemTiro.Label = mylist[index].DsObjeto;
pinOndeTemTiro.Address = mylist[index].NmInformacao;
pinOndeTemTiro.Position = new Position(mylist[index].Latlong.Lat, mylist[index].Latlong.Lng);
map.Pins.Add(pinOndeTemTiro);
}
catch (Exception ex)
{
}
}
But, how I told, when has 500 items works nicelly. But when has almost 5.000 , locks and nothing happens.
I guess you should reuse your BitmapDescriptor instead of creating the same one for each pin.
Also, in your loop you should create a new instance of Pin on every iteration.
I guess you should reuse your BitmapDescriptor instead of creating the same one for each pin.
Also, in your loop you should create a new instance of Pin on every iteration.
Serious? Don´t you think will be slower ?
Well, adding the same object to a collection many times is wrong, unless you want to add the exact same instance of the object (same labels, position, …) to the Pins collection?
Please check out the issue #497 .
And our sample app's code.
Well, adding the same object to a collection many times is wrong, unless you want to add the exact same instance of the object (same labels, position, …) to the Pins collection?
Well, but thats the point. If the Image and others parameters are the same, why create another collection ? I am creating a collection of Pins A that has differents labels and positions, but same Image A ...then a collection of Pins B with different labels and positions, but same image B... and continuous
Pin pinApreensaoFuzil = new Pin()
{
Tag = "fuzil",
Type = PinType.Place,
Label = "Apreensão Fuzil",
Icon = BitmapDescriptorFactory.FromBundle("apreensaofuzil.png")
};
Please check out the issue #497 .
And our sample app's code.
I already using it. Doesn´t work .
Did you find a solution?
Did you find a solution?
No.
Did you find a solution?
No.
Try to use pin aggregation depended on altitude(zoom). Group some near pins to one pin with count label of pins inside it. When you zoom in - groups becomes less and scattered
Did you find a solution?
No.
Try to use pin aggregation depended on altitude(zoom). Group some near pins to one pin with count label of pins inside it. When you zoom in - groups becomes less and scattered
could you write some code as example of doing this explanation? I have the same problem and I want to reduce time of drawing so many pins in map
i am same trouble did you find good solution @justwooper
I don't know why you should show 5000+ pin in map/screen?
Could you tell me your use case?
Me over 500+ this is vehicle tracking system but we need plate number over the pin @ammay077
Did you find a solution?
No.
Try to use pin aggregation depended on altitude(zoom). Group some near pins to one pin with count label of pins inside it. When you zoom in - groups becomes less and scattered
could you write some code as example of doing this explanation? I have the same problem and I want to reduce time of drawing so many pins in map
If you don't want to use aggregation, check your caching. This library has some problems with it.
Check this, maybe it is your case. But it is about BitmapDescriptorFactory.FromView() laggs. I don't know how good caching optimized with BitmapDescriptorFactory.FromBundle(). Sorry for my bad english
Hello i solved my problem with SkiaSharp i tested 1000 pins without any performans issue..
but i dont understand why android has this solution xamarin forms doesnt have
Hello i solved my problem with SkiaSharp i tested 1000 pins without any performans issue..
but i dont understand why android has this solution xamarin forms doesnt have
how did skia helped to you? Can you show piece of code?
Hey @BurakOgutken could you please share your solution with us?