I am writing a web mapping application and I use ArcGIS Server services. I want the application to use Google Maps as a base map. I am new to this job. I have searched a lot on the Internet. But I could not find anything useful. Is there anyone who could help me in this matter. Sample site are shown below.
4 Answers
As stated in other answer, using google's map tile directly violates their TOS. If you are not married to Silverlight, you can approach this from a different angle and overlay arcgis services onto a google map instead of inserting a google basemap into an arcgis map.
This walks through the basic steps: http://help.arcgis.com/en/webapi/javascript/gmaps/help/google_start.htm#topics/gmaps_addmap.html
You still need to be compliant with google's TOS, but you have much greater flexibility when you build on top of google's gmap.
Google licensing terms generally prohibit accessing their tile service from outside of the controls they provide.
How about using Add Data from GIS Online which is provided by ESRI, it will also serves you as Google maps you are looking for.
Hope this helpful.!
-
I am from Iran. Our country has been sanctioned by the company ESRI. So I can not use the company's services Commented Jul 17, 2013 at 3:45
based on Russell answer .
Google licensing terms generally prohibit accessing their tile service from outside of the controls they provide
but you can use this class as a layer in you application.
public enum TypeOfTile
{
sateliteImage,
map
}
public static class TypeOfTileExtensions
{
public static string TotileString(this TypeOfTile me)
{
switch (me)
{
case TypeOfTile.sateliteImage:
return "s@92";
case TypeOfTile.map:
return "m@161000000";
default:
return "t@128";
}
}
}
public class GoogleTilecLayer : TiledMapServiceLayer
{
private const double cornerCoordinate = 20037508.3427892;
private string _baseURL;
public GoogleTilecLayer(TypeOfTile typetile)
{
_baseURL = typetile.TotileString();
}
public override void Initialize()
{
ESRI.ArcGIS.Client.Projection.WebMercator mercator = new ESRI.ArcGIS.Client.Projection.WebMercator();
this.FullExtent = new ESRI.ArcGIS.Client.Geometry.Envelope(-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892)
{
SpatialReference = new SpatialReference(102100)
};
this.SpatialReference = new SpatialReference(102100);
this.TileInfo = new TileInfo()
{
Height = 256,
Width = 256,
Origin = new MapPoint(-cornerCoordinate, cornerCoordinate) { SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100) },
Lods = new Lod[16]
};
double resolution = cornerCoordinate * 2 / 256;
for (int i = 0; i < TileInfo.Lods.Length; i++)
{
TileInfo.Lods[i] = new Lod() { Resolution = resolution };
resolution /= 2;
}
base.Initialize();
}
public override string GetTileUrl(int level, int row, int col)
{
string url = "http://mt" + (col % 4) + ".google.cn/vt/lyrs=" + _baseURL + "&v=w2.114&hl=en_US&gl=cn&" + "x=" + col + "&" + "y=" + row + "&" + "z=" + level + "&s=Galil";
if (_baseURL == "s@92")
{
url = "http://mt" + (col % 4) + ".google.cn/vt/lyrs=" + _baseURL + "&v=w2.114&hl=en_US&gl=cn&" + "x=" + col + "&" + "y=" + row + "&" + "z=" + level + "&s=Galil";
}
if (_baseURL == "t@128")
{
url = "http://mt" + (col % 4) + ".google.cn/vt/lyrs=" + _baseURL + ",r@169000000&v=w2.114&hl=en_US&gl=cn&" + "x=" + col + "&" + "y=" + row + "&" + "z=" + level + "&s=Galil";
}
if (_baseURL == "m@161000000")
{
url = "http://mt" + (col % 4) + ".google.cn/vt/lyrs=" + _baseURL + "&v=w2.114&hl=en_US&gl=cn&" + "x=" + col + "&" + "y=" + row + "&" + "z=" + level + "&s=Galil";
}
return string.Format(url);
}
}