Skip to content

JoseClua/TK.CustomMap

 
 

Repository files navigation

Extended Map Control for Xamarin.Forms.Maps

NuGet Build status

This is an extended, bindable map control based on Xamarin.Forms.Maps. Here is a list of some available features:

  • Customize pins
  • Custom image
  • Draggable
  • and more
  • Add overlays
  • Circles
  • Lines
  • Custom polygons
  • Add and calculate routes
  • Start place prediction queries
  • Add custom map tiles via url template
  • Additional commands available
  • Long press
  • Map click
  • and many more

Look at the wiki for all available features and documentation.

Setup

Install the NuGet package.

Android

Add your Google Maps API key to your AndroidManifest.xml.

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR API KEY" />

Following permissions should be added to your AndroidManifest.xml

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

If you plan to use the automatic route calculation, a valid key for the Google Maps Directions API is required. You can set it up anywhere in your PCL, simply call GmsDirection.Init("YOUR API KEY");.

If you plan to use the NativePlacesApi make sure you have a valid key for the Google Places API and set the key in your AndroidManifest.xml. Replace the following line

<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="YOUR API KEY" />

with

<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR API KEY" />

iOS

Make sure you call TKCustomMapRenderer.InitMapRenderer(); in FinishedLaunching in your AppDelegate.cs.

If you plan to use the NativePlacesApi also call NativePlacesApi.Init();

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    Forms.Init();
    FormsMaps.Init();
    TKCustomMapRenderer.InitMapRenderer();
    NativePlacesApi.Init();
    
    LoadApplication(new App());
    return base.FinishedLaunching(app, options);
}

UWP

Make sure you call FormsMaps.Init("Your_key_here"); in your MainPage.xaml.cs before LoadApplication(new Sample.App());. Also you need the Location capability in your app manifest.

Contributions

If you want to contribute, please use the Development branch to submit PRs.

Known Issues

Image offset

If you notice wrong offsets or moving images during zoom, you can use the Anchor property to properly adjust the anchor point.

Video

Android

Android

iOS

iOS

Contributors

About

Extended Map Control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%