TileLayer google map

Topics: SharpMap Project, SharpMap v0.9 / v1.x
May 10, 2010 at 9:35 PM
Edited May 10, 2010 at 9:35 PM

Does anybody know how to use TileLayer with google maps?

I know how to use bing maps, open street, but not yet google maps. Can somebody share example code please?

Thank you for you help

 

Developer
May 11, 2010 at 6:32 AM

There is no specific support for it but it can be configured. You need to fake the user agent and referer so it is not usable in a professional application.

string userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14"; 
string referer = "http://maps.google.com/maps";
var request = new BasicRequest("http://khm0.google.com/kh/v=60&x={1}&s=&y={2}&z={0}&s=");
ITileSource tileSource = new TileSource(new WebTileProvider(request, userAgent, referer, false), new SphericalMercatorInvertedWorldSchema());