Google Maps - Get Map Position using GPS
2012-03-23 by
This post will show you how to gather some information using the GPS API from the Windows Mobile device. This will then allow a user to download the 640x640 map from Google's Static Map Service with the center location as the current position of the GPS Device. This is an interim solution until Google Maps supports the ability to use the Map service without Javascript having to be enabled.
To download static maps from google you will need to do the following
- Get you Google Maps API Developer Key from Google's API Center
- The key provided will be used to replace GOOGLE_API_KEY in all of the sample code
- Create a class that will construct a Google Maps Static Map Call for you
- Download the Map using the HTTP Handler
- Return the bitmap to the application
Google Maps - Static Map Builder Class
using System;
using System.Globalization;
using System.Net;
using System.Drawing;
using System.Collections.Generic;
GoogleMapsSample.StaticMapGetter getter = new GoogleMapsSample.StaticMapGetter();
Bitmap bmpBackImage = getter.GetMap(position.Latitude, position.Longitude, 19, "satellite", "GOOGLE_API_KEY");