Over a million developers have joined DZone.

Tip of the day for Windows Phone developers - the Map control is not always necessary

DZone's Guide to

Tip of the day for Windows Phone developers - the Map control is not always necessary

· Mobile Zone
Free Resource

Discover how to focus on operators for Reactive Programming and how they are essential to react to data in your application.  Brought to you in partnership with Wakanda

If you look in the Windows Phone Marketplace, you will notice that there is a plethora of applications that are using device-based location and maps. There is the Map control that facilitates the use and customization of user's surroundings, but what some developers don't know is that for some static content the Map control is overkill.

Instead, it is worth looking at the open Bing Maps API that allows the developer to access location tiles in different formats and sizes, as long as the longitude and the latitude of a searched point are known.

For example, here is a service request URL that will return a location tile:


Notice how I am passing the latitude and the longitude via the c parameter. w and h parameters determine the width and height of the returned image. b is the appearance descriptor. In this case, there is a device.mobile option that will increase the frequency of different location indicators (e.g. street names or highway numbers).

The z parameter is the zoom factor. This value has the range: 1 to 21 (21 being the highest). Going beyond this range will cause a Bad Request error.

But I don't want the logo on the map...

For whatever reason you might need to remove the logos from the tile (e.g. taking too much space), you can do this through the same URL parameters. To remove the Bing logo, use the logo=no pair. To remove the NAVTEQ reference, use the da=n pair. Compare the two images above to see what I am talking about.

How can I get the lat/lon values?

The coordinates used in the service request are used in the same format as the latitude and longitude returned by GeoCoordinateWatcher:

GeoCoordinateWatcher watcher;
public MainPage()

    watcher = new GeoCoordinateWatcher();
    watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);

void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
    Debug.WriteLine(e.Position.Location.Latitude + " " + e.Position.Location.Longitude);

These service endpoints can be extremely useful for what Windows Phone does best - implement live tiles.

Learn how divergent branches can appear in your repository and how to better understand why they are called “branches".  Brought to you in partnership with Wakanda


Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}