This should be my final integration of the domestic map, if there is energy will continue to analyze Google Maps, Bing Maps, Yahoo maps, ovi map.
At the same time, the use of offline maps and the data storage section will be shared as soon as possible.
Links to previous related articles:
Deep understanding of the strongest desktop map control gmap.net---Principle
Deep understanding of the strongest desktop map control gmap.net---soso map
Deep understanding of the strongest desktop map controls gmap.net---Baidu map
In-depth understanding of the strongest desktop map control gmap.net---First use
Deep understanding of the strongest desktop map control gmap.net---first knowledge
How to use gmap.net Sogou map in your program
To use the following code, it is recommended to look at the first article, the specific code is as follows.
This. Mainmap.position = new POINTLATLNG (double. Parse (configurationmanager.appsettings["Defaultlat"]), double. Parse (configurationmanager.appsettings["defaultlng")); MainMap.MapProvider.Area = new Rectlatlng (30.981178, 105.351914, 2.765142, 4.120995); Mainmap.boundsofmap = new Rectlatlng (30.981178, 105.351914, 2.765142, 4.120995); MainMap.Manager.Mode = Accessmode.cacheonly;this. Mainmap.mapprovider = Gmapproviders.sogoumapprovider;this. Mainmap.dragbutton = Mousebutton.left;this. Mainmap.zoom = 13;this. Mainmap.minzoom = 8;this. Mainmap.maxzoom = 24;
the effect of gmap.net Sogou map
General Map
Satellite map
Sogou Map Loading principle
To understand how to load Sogou map, but also to understand the loading principle, we use chrome to open http://map.sogou.com/, arbitrarily locate an address, open the developer tool:
You can see the tile's address as follows: Http://p2.go2map.com/seamless1/0/174/717/3/1/744_212.png
Parse the URL link parameter:
http://p2.go2map.com/seamless1/0/174 is fixed.
717=729-zoom level (zoom)
3= Grid Horizontal/200 The nearest integer value =math.floor (x/200).
1= Grid ordinate/200 nearest integer value =math.floor (y/200).
744 is the horizontal axis of the grid.
212 is the grid ordinate.
Anyway above these parameters I also patchwork a lot of information to, indeed Sogou is very strange.
Let's see how to implement Sogou map in Gmap.net.
Sogoumapprovider
1) Add abstract class Sougoumapproviderbase
Since Sogou maps also have regular maps and satellite maps, it provides an abstract class with public methods that can be reused.
PublicAbstractClassSogoumapproviderbase:gmapprovider {PublicSogoumapproviderbase () {maxzoom =Null; Refererurl ="Http://map.sougou.com"; Copyright =String. Format ("©{0} Sogou corporation,©{0} navteq,©{0} Image courtesy of NASA", DateTime.Today.Year); }PublicOverridePureprojection Projection {get {ReturnMercatorprojection.instance; }} gmapprovider[] overlays;PublicOverrideGmapprovider[] Overlays {Get{if (overlays = =Null) {overlays =New gmapprovider[] {This}; }ReturnOverlays } }Protectedoverride boolvar pass = baseif (! Pass) {return response. ResponseUri.AbsoluteUri.EndsWith ( ".png") || Response. ResponseUri.AbsoluteUri.EndsWith ( " ");} return true
2) Add Sougoumapprovider
PublicClassSogoumapprovider:sogoumapproviderbase {PublicStaticReadOnlySogoumapprovider Instance;ReadOnly Guid ID =New Guid ("7e2a0100-7a75-4c49-a2c9-ee1c73947e10");PublicOverrideGuid Id {get {ReturnId } }ReadOnlyString name ="Sohumap";PublicOverrideStringName {Get{ReturnName } }StaticSogoumapprovider () {Instance =NewSogoumapprovider (); }PublicOverride Pureimage Gettileimage (Gpoint pos,IntZoom) {String url =Maketileimageurl (POS, zoom, LANGUAGESTR);ReturnGettileimageusinghttp (URL); }String Maketileimageurl (Gpoint pos,int zoom,StringLanguage) {zoom = Zoom-1;var OffsetX = Math.pow (2, zoom);var OffsetY = OffsetX-1;var numx = pos. XOffsetX;var numy =-pos. Y +OffsetY; Zoom = Zoom +1;var zoomlevel =729-Zoomif (Zoomlevel = =710) {Zoomlevel =792; }var blo = Math.floor (numx/200);var bla = Math.floor (numy/200);StringBlos, Blas;if (Blo <0) {Blos ="M" + (-BLO); }Else{Blos =Blo. ToString (); }if (Bla <0) {Blas ="M" + (-BLA); }Else{Blas =Bla. ToString (); }var x = numx.tostring (). Replace ("-","M");var y = numy.tostring (). Replace ("-","M");//http://p1.go2map.com/seamless1/0/174/720/0/0/95_25.png string url = string. Format (Urlformat, "1" "url: "+ URL); return URL;} static readonly string Urlformat = "http://p{0}.go2map.com/seamless1/0/174/ {1}/{2}/{3}/{4}_{5}.png "
Original link: http://www.cnblogs.com/enjoyeclipse/archive/2013/01/29/2880791.html
(turn) deep understanding of the strongest desktop map controls gmap.net---sogou (Sougou map)