ArcGIS API for Silverlight load Google map (later)

Source: Internet
Author: User
Tags silverlight

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 );}}}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.