New Plugin - MapExtend

RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

I build this Plugin

MapExtend for Xamarin.Forms is a plugin for Xamarin.Forms

allowing users to draw routes, reveal nearby locations, distance between two points

and place pins at certain addresses.

https://www.nuget.org/packages/Xam.Plugin.MapExtend

Thanks @pierce.boggan @JamesMontemagno @MitchMilam

Posts

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    @TimF See ;D

  • KarlKoppKarlKopp AUMember ✭✭

    Nice work, will definitely take a look. One feature that would be super useful would be custom pins as thats a big gap (IMO) in the current XF.Maps libs...

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    @Kolchy I work on :)

    Thanks

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    @Kolchy try this alpha test please

    https://www.nuget.org/packages/Xam.Plugin.MapExtend/1.2.1-alpha

    To add Custom Pins use this

    MapExtend.EPins.Add(new PinExtend()
    {
    Name = item.name,
    Details = item.name,
    Location = new Position(item.geometry.location.lat, item.geometry.location.lng),
    ResourceNameImg = "ImgResourceName.format"
    });

    I Think This Work, but need test... Can u do it please? ;D

  • KarlKoppKarlKopp AUMember ✭✭

    Tried on iOS and Android and get a NullReferenceException when trying to add the pin to the map (map.EPins.Add(pin)). Here is my code:

    using System;
    
    using Xamarin.Forms;
    using Xamarin.Forms.Maps;
    using Xam.Plugin.MapExtend.Abstractions;
    
    namespace MapExtend
    {
        public class MapPage : ContentPage
        {
            public MapPage ()
            {
    
                var map = new Xam.Plugin.MapExtend.Abstractions.MapExtend(
                    MapSpan.FromCenterAndRadius(
                        new Position(-37.8,144.9), Distance.FromKilometers(1))) {
                    IsShowingUser = true,
                    HeightRequest = 100,
                    WidthRequest = 960,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
    
                var pin = new PinExtend ();
                pin.Name = "Pin name";
                map.EPins.Add(pin);
    
                Content = new StackLayout { 
                    Children = {
                        map
                    }
                };
            }
        }
    }
    
  • DirkWeltzDirkWeltz DEMember ✭✭✭

    @Kolchy perhaps you missed the Location of the pin?

  • KarlKoppKarlKopp AUMember ✭✭

    Even if I add Location and Details (like below, I get an error).

    var pin = new PinExtend { Name = "Pin name", Location = new Position (-37.8, 144.9), Details = "Pin details" };

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    Try MapExtend() without params

    i forgot instance EPins on MapExtend(params)

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭
  • KarlKoppKarlKopp AUMember ✭✭

    Hey @RafaelMoura - tested 1.2.2-alpha, and I no longer get the exception thrown, but I don't see any pins. I tried with and without a ResourceNameImg. I can add a Xamarin.Forms.Map Pin, but not a PinExtended. It just doesn't show any pin. Code below:

    namespace MapExtend
    {
        public class MapPage : ContentPage
        {
            public MapPage ()
            {
                var pos = new Position (-37.81362, 144.9631);
                var map = new Xam.Plugin.MapExtend.Abstractions.MapExtend(
                    MapSpan.FromCenterAndRadius(
                        pos, Distance.FromKilometers(1))) {
                    IsShowingUser = true,
                    HeightRequest = 100,
                    WidthRequest = 960,
                    HasZoomEnabled = true,
                    VerticalOptions = LayoutOptions.FillAndExpand
                };
    
                var pin = new PinExtend {
                    Name = "Pin name",
                    Location = pos,
                    Details = "Pin details",
                    ResourceNameImg = "Icon-76.png"
                };
    
                var pin2 = new Pin {
                    Label = "Old pin",
                    Position = pos,
                    Address = "Some address"
                };
    
                // map.Pins.Add(pin2);
                map.EPins.Add (pin);
    
                Content = new StackLayout { 
                    Children = {
                        map
                    }
                };
            }
        }
    }
    
  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    @Kolchy try remove "png" use only Icon-76

  • RafaelMouraRafaelMoura BRInsider, University, Developer Group Leader ✭✭✭

    See :) Its Work Here

  • KarlKoppKarlKopp AUMember ✭✭

    Hey Rafael - have you time for a skype msg session on this? I'm keen to help get to the bottom of it. Currently, on iOS there is no pin displayed, and on Android I get a nullref exception trying to load MapExtend.

  • KarlKoppKarlKopp AUMember ✭✭

    Here is the exception details. I have registered MapExtend in my MainActivity, and get this when trying to show a map (no pins):

    [mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
    [mono-rt]   at Xam.Plugin.MapExtend.Droid.MapExtendRenderer.OnElementChanged (Xamarin.Forms.Platform.Android.ElementChangedEventArgs`1 e) [0x00000] in <filename unknown>:0 
    [mono-rt]   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[Xamarin.Forms.View].SetElement (Xamarin.Forms.View element) [0x00000] in <filename unknown>:0 
    [mono-rt]   at Xamarin.Forms.Platform.Android.VisualElementRenderer`1[Xamarin.Forms.View].Xamarin.Forms.Platform.Android.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <filename unknown>:0 
    [mono-rt]   at Xamarin.Forms.Platform.Android.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0 
    
  • KarlKoppKarlKopp AUMember ✭✭

    @RafaelMoura if I add Xam.Plugins.Gelocator I can run it on Android. Pin still not showing tho - I'll keep looking...

  • KittyYoKittyYo USMember

    @Kolchy did you manage to figure out this bitch ass issue? Sorry, this is a really late question...

  • KarlKoppKarlKopp AUMember ✭✭

    @KittyYo I ended up switching to a new map - https://www.nuget.org/packages/TK.CustomMap/ - been awesome ;)

  • KittyYoKittyYo USMember

    @Kolchy Thanks for the reply man!

    Been banging my head against the MapExtend Plugin for a few hours unable to get those god damn custom pins to show up...

    Anywho for sake of sanity I'm gonna ditch MapExtend and try out TK.CustomMap!

    Thanks again!

  • Emixam23Emixam23 USMember ✭✭✭

    Hi, sorry to up this post but I have some questions ! :) first I want to install your package but it doesn't seems to work, I don't know if it's normal :/ Second, I'm trying since 2 weeks to draw a path bewteen 2 points on the Xamarin.Forms.Maps... almost impossible.. So I found your package and I would like to know if you provide some documentation about it? :)

    Thank

  • Jay-MayuJay-Mayu USMember ✭✭

    @KarlKopp said:
    @KittyYo I ended up switching to a new map - https://www.nuget.org/packages/TK.CustomMap/ - been awesome ;)

    This is really good. I could place custom image for the pin.

  • ThomasHagstrmThomasHagstrm SEMember ✭✭

    @Jay-Mayu said:

    @KarlKopp said:
    @KittyYo I ended up switching to a new map - https://www.nuget.org/packages/TK.CustomMap/ - been awesome ;)

    This is really good. I could place custom image for the pin.

    Not so sure: on iOS setting center location doesn't work and on UWP the pins don't show at all.

  • Jay-MayuJay-Mayu USMember ✭✭

    @ThomasHagstrm said:

    @Jay-Mayu said:

    @KarlKopp said:
    @KittyYo I ended up switching to a new map - https://www.nuget.org/packages/TK.CustomMap/ - been awesome ;)

    This is really good. I could place custom image for the pin.

    Not so sure: on iOS setting center location doesn't work and on UWP the pins don't show at all.

    I'm not sure why it was not working for you. It works just fine for me in iOS. Sorry I didn't try on UWP as my project is focused on Android & iOS only.

  • TorbenKruseTorbenKruse DEMember ✭✭✭

    It won't work for UWP as there is no renderer yet. You'll only get the basic Xamarin Maps functionality.

  • Jay-MayuJay-Mayu USMember ✭✭

    @TorbenKruse said:
    It won't work for UWP as there is no renderer yet. You'll only get the basic Xamarin Maps functionality.

    That totally makes sense

Sign In or Register to comment.