Essentials: OpenMaps API

Created on 12 Jun 2018  路  7Comments  路  Source: xamarin/Essentials

Original Implementations: https://github.com/jamesmontemagno/LaunchMapsPlugin

OpenMaps would do just that... open the maps to a specific destination on the map and allow the developer to specify the direction type.

API:

Task OpenMapsAsync(Location location, MapLaunchOptions options);
Task OpenMapsAsync(double latitude, double longitude, MapLaunchOptions options);
Task OpenMapsAsync(Placemark placemark, MapLaunchOptions options);

Struct: MapLaunchOptions

public MapNavigation MapNavigation {get;set;}
public string Name { get; set; }

Enums:

enum MapNavigation
{
    Default,
    Driving,
    Walking
}

Implementations

  • iOS: MapItem has this built in
  • Android: Launch Intents to Google Maps else Default app
  • UWP: bingmaps: launch uri for maps
in-progress ready-to-implement

All 7 comments

I would like to see MapNavigation extended by Location, so that one could possibly also only display the location which was specified instead of looking for a route.

I took a look at your implementation @jamesmontemagno and you return a bool indicating success of the launch operation. As your api does not specify this I reckon we would throw an Exception when a Placemark is unresolvable? I would not like to see a silent failure on an api call.

Also, this could partially benefit from the new Launcher API. On UWP this launches a bingmaps uri. Implementing this would simply be an argument conversion call to format the URI. Android would be somewhat similar with also launching a Uri.

I implemented this here. I tested it on all platforms, I only have to add unit tests and enter the doc info. the updated docs are already pushed, just not filled out yet.

I have 0.9.1-preview installed but I can't get the Map nor OpenMap..

How can I get this function?

yes solved. sorry.. ,my shared project did not update the xamarin essential while ios and android were updated. Thanks.

Was this page helpful?
0 / 5 - 0 ratings