Integrate a Map into your App!

To be able to integrate a Map control into your new app that is going to make use of HERE Maps, it’s firstly necessary to enable the application ID_CAP_MAP attribute, which can be found in the WMAppManifest.xml file. This will grant your app the capability of using the maps contained in your phone (or the rights to download them on the spot from the Internet, as well).

Without this first step, your app will be relentlessly crashing again and again, so (pretty please) don’t miss it 😉

 

This done, you’ll need to manage an import to actually be able to place your Map into the XAML file. The import is made adding this line of code:

xmlns:maps=”clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps”

Now we can create the map! This is the code for it:

<maps:Map x:Name=”MyMap”/>

 

At this point, should you decide running your app “as it is”, you’ll have just your map (supposing you have placed nothing else but it) with its basic settings. Basically it’s like opening HERE Maps, no more.

Should you want to customize your map behaviour, these are the properties that are avalaible and that you NEED to know:

  •  ZoomLevel (1-20, 1 being the zoom level most zoomed out)
  • Heading (Directional heading pointing “up” on the map – N = 0, E = 90, S = 180, W = 270)
  • Pitch (the tilt of the map, the inclination you see the map at, from perpendicular all the way to parallel)
  • CartographicMode (road, aerial, hybrid, terrain)
  • ColorMode (light and dark – effect on road cartographic mode only)
  • LandmarksEnabled (displays 3-D object of prominent buildings and landmarks overlayed on the map when enabled)
  • PedestrianFeaturesEnabled (displays pedestrian features such as stairs when enabled)

 

You may set these attributes either directly into your XAML code or access them from the C# code.

 

Happy mapping! 😉

Un pensiero su “Integrate a Map into your App!

  1. Pingback: Visual Studio updates, and so we do! HERE Maps import | GUIDO MAGRIN

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione / Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione / Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione / Modifica )

Google+ photo

Stai commentando usando il tuo account Google+. Chiudi sessione / Modifica )

Connessione a %s...