Previously mentioned in the blog (http://blog.csdn.net/taomanman/article/details/8019687) to load Google map scheme, because of Google address problems, do not see the figure, found that the URL address conversion caused.
The following three types are published:
Using system; using system. net; using system. windows; using system. windows. controls; using system. windows. documents; using system. windows. ink; using system. windows. input; using system. windows. media; using system. windows. media. animation; using system. windows. shapes; using ESRI. arcGIS. client; using ESRI. arcGIS. client. geometry; namespace mapclient. commonclass {public class googlemaplayer: tiledmapservicelayer {private const double cornercoordinate = 20037508.3427892; Public String _ baseurl = "t @ 131"; // Google topographic map 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)}; // spatial Coordinate System of the layer this. spatialreference = new spatialreference (102100); // create the slice information. The size of each slice is 256 * PX, which consists of 16 levels. this. tileinfo = new tileinfo () {Height = 256, width = 256, origin = new mappoint (-cornercoordinate, cornercoordinate) {spatialreference = new ESRI. arcGIS. client. geometry. spatialreference (102100)}, lods = new d3[ 18]}; // creates a solution for each level, and each level is half of the previous level. double resolution = cornercoordinate * 2/256; For (INT I = 0; I <tileinfo. lods. length; I ++) {tileinfo. lods [I] = new LD () {resolution = resolution}; resolution/= 2;} // call the initialization function base. initialize ();} public override string gettileurl (INT level, int row, int col) {string url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga "; if (_ baseurl = "t @ 131") {// Topographic Map url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} if (_ baseurl = "s @ 132 ") {// satellite map url = "http://mt3.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = G ";} if (_ baseurl = "m @ 225000000 ") {// Street chart url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col + "& "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} return string. format (URL );}}}
Using system; using system. net; using system. windows; using system. windows. controls; using system. windows. documents; using system. windows. ink; using system. windows. input; using system. windows. media; using system. windows. media. animation; using system. windows. shapes; using ESRI. arcGIS. client; using ESRI. arcGIS. client. geometry; namespace mapclient. commonclass {public class googlemaproadlayer: tiledmapservicelayer {private const double cornercoordinate = 20037508.3427892; private string _ baseurl = "m @ 225000000"; // Google traffic map 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)}; // spatial Coordinate System of the layer this. spatialreference = new spatialreference (102100); // create the slice information. The size of each slice is 256 * PX, which consists of 16 levels. this. tileinfo = new tileinfo () {Height = 256, width = 256, origin = new mappoint (-cornercoordinate, cornercoordinate) {spatialreference = new ESRI. arcGIS. client. geometry. spatialreference (102100)}, lods = new d3[ 19]}; // creates a solution for each level, with each level being half of the previous level. double resolution = cornercoordinate * 2/256; For (INT I = 0; I <tileinfo. lods. length; I ++) {tileinfo. lods [I] = new LD () {resolution = resolution}; resolution/= 2;} // call the initialization function base. initialize ();} public override string gettileurl (INT level, int row, int col) {string url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga "; if (_ baseurl = "t @ 131") {// Topographic Map url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} if (_ baseurl = "s @ 132 ") {// satellite map url = "http://mt3.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = G ";} if (_ baseurl = "m @ 225000000 ") {// Street chart url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col + "& "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} return string. format (URL );}}}
Using system; using system. net; using system. windows; using system. windows. controls; using system. windows. documents; using system. windows. ink; using system. windows. input; using system. windows. media; using system. windows. media. animation; using system. windows. shapes; using ESRI. arcGIS. client; using ESRI. arcGIS. client. geometry; namespace mapclient. commonclass {public class googlemapsateliatelayer: tiledmapservicelayer {private const double cornercoordinate = 20037508.3427892; private string _ baseurl = "s @ 132"; // Google satellite map 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)}; // spatial Coordinate System of the layer this. spatialreference = new spatialreference (102100); // create the slice information. The size of each slice is 256 * PX, which consists of 16 levels. this. tileinfo = new tileinfo () {Height = 256, width = 256, origin = new mappoint (-cornercoordinate, cornercoordinate) {spatialreference = new ESRI. arcGIS. client. geometry. spatialreference (102100)}, lods = new d3[ 20]}; // creates a solution for each level, and each level is half of the previous level. double resolution = cornercoordinate * 2/256; For (INT I = 0; I <tileinfo. lods. length; I ++) {tileinfo. lods [I] = new LD () {resolution = resolution}; resolution/= 2;} // call the initialization function base. initialize ();} public override string gettileurl (INT level, int row, int col) {string url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga "; if (_ baseurl = "t @ 131") {// Topographic Map url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + ", r @ 225000000 & HL = ZH-CN & GL = cn & src = app & "+" x = "+ Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} if (_ baseurl = "s @ 132 ") {// satellite map url = "http://mt3.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col +" & "+" Y = "+ row +" & "+" z = "+ level +" & s = G ";} if (_ baseurl = "m @ 225000000 ") {// Street chart url = "http://mt1.google.cn/vt/lyrs=" + _ baseurl + "& HL = ZH-CN & GL = cn & src = app &" + "x =" + Col + "& "+" Y = "+ row +" & "+" z = "+ level +" & s = Ga ";} return string. format (URL );}}}