The reading examples of the map World Service have produced results in the past two years. Here, we provide code to supplement the integrity of the full series of topics and provide parameters only. Apart from the differences between image obtaining functions and other functions, the other methods for the previous two topics are consistent.
Public class
Ngcctiledmaplayer:
Tiledmapservicelayer
{
// ***************** Modify the address based on the actual address of the map world
{Baseurl} parameter *************//
// Privateconst string baseurl = "http://map.sxch.gov.cn: 7001/geoglobe/dataserver? T = china400 &";
Privateconst
Stringbaseurl1 = "http: // tile ";
// Privateconst string baseurl2 = ".tianditu.com/dataserver? T = a0512_emap &";
Privateconst
Stringbaseurl2 = ".tianditu.com/dataserver? T = b0627_emap1112 &";
System. randomra =
New system. Random ();
Privateconst
Int wkid = 4326;
Public
Override voidinitialize ()
{
// The full graph range of the layer
This. fullextent =
New ESRI. ArcGIS. Client. Geometry. Envelope (-180,-90,180, 90)
{
Spatialreference = new ESRI. ArcGIS. Client. Geometry. spatialreference (wkid)
};
// Layer Space reference
This. spatialreference =
New ESRI. ArcGIS. Client. Geometry. spatialreference (wkid );
// Set the slice information.
The size of each slice is 256x256px, 14 levels
This. tileinfo =
New tileinfo ()
{
Height = 256,
Length = 256,
Origin = new ESRI. ArcGIS. Client. Geometry. mappoint (-180, 90) {spatialreference =
New ESRI. ArcGIS. Client. Geometry. spatialreference (wkid )},
Lods = new ESRI. ArcGIS. Client. layd [20]
};
// Set the resolution of each level. Each level of resolution is half of the previous level.
Doubleresolution = 0.70391441567318025*1.99775 ;//****************
Modify adjustment coefficient based on the actual address of the map
*************//
For (INT I = 0; I <tileinfo. lods. length; I ++)
{
Tileinfo. lods [I] = new
Levels () {resolution = resolution };
Resolution/= 2;
}
// Call the initialization event
Base. initialize ();
}
/// Return the URL of the specified slice
Public
Override stringgettileurl (INT level,
Introw, int col)
{
Returnbaseurl1 + RA. Next (1, 7). tostring () + baseurl2 +
"L =" + level. tostring () +
"& X =" + col. tostring () + "& Y =" + row. tostring ();
// Returnbaseurl + "L =" + level. tostring () + "& X =" + col. tostring () + "& Y =" + row. tostring ();
}
}