Home Screen :

Name of Experiment : : Geo-Coordinate using Map

Exp No : MC8

Background : Student should have a basic knowledge of C#.

Summary : People are very much curious about finding their own location on the digital map. A-GPS technology has solved this problem to far extent using several services provided by google maps, bing maps etc. We need to map our geo-coordinate points on the digital map by using pushpins or some marker.

Learning Objective : Using previous experiment (MC4 i.e. Get Location) you can able to fetch the geo-coordinates. Now, in this experiment student should able to learn the activity of calling digital map on the mobile device and draw his geo-coordinate on it.


Target Platform : This experiment is tested on Windows Phone Emulator and Nokia Lumia 800.



Source Code : Comments :
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>

<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ExperimentTitle" Text="ExpNo MC8" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>

<TextBlock x:Name="PageTitle" Text="Geo-Coordinates using Map" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Margin="12,149,12,12" Grid.RowSpan="2">
<my:Map Height="462" CredentialsProvider="Your Bing Map Key" HorizontalAlignment="Left" Margin="6,6,0,0" Name="map1" VerticalAlignment="Top" Width="444" />

<Button Content="Road Mode" Height="72" HorizontalAlignment="Left" Margin="6,474,0,0" Name="buttonRoad" VerticalAlignment="Top" Width="207" Click="buttonRoad_Click" />
<Button Content="Aerial Mode" Height="72" HorizontalAlignment="Left" Margin="243,474,0,0" Name="buttonAerial" VerticalAlignment="Top" Width="207" Click="buttonAerial_Click" />
<Button Content="Zoom In" Height="72" HorizontalAlignment="Left" Margin="6,535,0,0" Name="buttonZoomIn" VerticalAlignment="Top" Width="207" Click="buttonZoomIn_Click" />
<Button Content="Zoom Out" Height="72" HorizontalAlignment="Left" Margin="243,535,0,0" Name="buttonZoomOut" VerticalAlignment="Top" Width="207" Click="buttonZoomOut_Click" />

 Exp No MC8(Experiment title)

 Mobile Computing(Application title)

 Geo-Coordinates using Map(Page Title)

 Road Mode(button)

 Aerial Mode (button)

 Zoom In(button)

 Zoom Out(button)

using System;
using System.Windows;
using Microsoft.Phone.Controls.Maps;
using Microsoft.Phone.Controls;
using System.Device.Location;

namespace MobileComputingTest
public partial class MainPage : PhoneApplicationPage
GeoCoordinateWatcher myWatcher;
// Constructor
public MainPage()
myWatcher = new GeoCoordinateWatcher();
myWatcher.PositionChanged+=new EventHandler<GeoPositionChangedEventArgs <GeoCoordinate>>(myWatcher_PositionChanged);

private void myWatcher_PositionChanged(object sender, GeoPositionChangedEventArgs e) {
ApplicationTitle.Text = String.Format("Latitude:{0}, Longitude:{1}",e.Position.Location.Latitude,
map1.Center = new GeoCoordinate(e.Position.Location.Latitude,
map1.ZoomLevel = 6;
Pushpin pin = new Pushpin();
pin.Location = new GeoCoordinate(e.Position.Location.Latitude,

private void buttonRoad_Click(object sender, RoutedEventArgs e)
map1.Mode = new RoadMode();
//map1.Center = new GeoCoordinate();
private void buttonAerial_Click(object sender, RoutedEventArgs e)
map1.Mode = new AerialMode();


private void buttonZoomIn_Click(object sender, RoutedEventArgs e)
double zoom;
zoom = map1.ZoomLevel;
map1.ZoomLevel = ++zoom;


private void buttonZoomOut_Click(object sender, RoutedEventArgs e)
double zoom;
map1.ZoomLevel = --zoom;

 Add Reference Microsoft.Phone.Controls.Maps and System.Device.Location

 Instantiate GeoCoordinateWatcher

 Body of myWatcher_PositionChanged(){}

 Priniting Geocoordinate

 Setting the GeoCoordinate on the Map

 Displaying RoadMode() view on the Map.

 Displaying AerialMode() view on the Map.

 Zoom In(button)

 Zoom Out(button)



Observation : It is observed that we can use this experiment in different Mobile App development.

Video Link

For Windows Phone


Right Click Here And Select Save Target For Entire Download :

Geo-Coordinate using Map Experiment