ArcGIS API for Silverlight overview

1、a cross-browser, cross-platform development environment for building and delivering rich Internet applications (RIA) for the web

2、You can also define the initial map extent and spatial reference in code-behind where you can use transformation logic to convert coordinates from one well-known spatial reference to another


1 ESRI.ArcGIS.Client.Geometry.Envelope initialExtent = new
2 ESRI.ArcGIS.Client.Geometry.Envelope(ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator( new
3 ESRI.ArcGIS.Client.Geometry.MapPoint(-130, 20)),
4 ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(new ESRI.ArcGIS.Client.Geometry.MapPoint(-65, 55)));
5  
6 initialExtent.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(102100);
7  
8 MyMap.Extent = initialExtent;
View Code

3、Map service layers come in two varieties, tiled and dynamic. Tiled service layers provide access to a set of map image tiles organized into predefined scale levels and hosted on a remote server. Dynamic service layers provide access to map and image services that generate map images on-the-fly.

1 <esri:ArcGISDynamicMapServiceLayer ID="CaliforniaLayer"
2   Url="http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer"
3   Initialized="CaliforniaLayer_Initialized" />
1 private void CaliforniaLayer_Initialized(object sender, EventArgs e)
2 {
3   Layer layer = sender as Layer;
4   MyMap.ZoomTo(layer.FullExtent);
5 }
<esri:ArcGISDynamicMapServiceLayer ID="CaliforniaLayer" 
  Url="http://serverapps.esri.com/ArcGIS/rest/services/California/MapServer"
  InitializationFailed="CaliforniaLayer_InitializationFailed" />
private void CaliforniaLayer_InitializationFailed(object sender, EventArgs e) 
{
  Layer layer = sender as Layer;
  string exceptionMessage = layer.InitializationFailure.Message;
  MyTextBlock.Text = exceptionMessage;
}

Map member

Map action

Extent property

Set to an ESRI.ArcGIS.Client.Geometry.Envelope. The map extent changes to the defined extent without animation. The actual extent of the map may not match the Envelope defined because the aspect ratio of the map must be preserved. To discover the actual extent, handle the ExtentChanged event on the map and use the NewExtent property on the event arguments. See the following code:

 

 
ESRI.ArcGIS.Client.Geometry.Envelope envelope = new
ESRI.ArcGIS.Client.Geometry.Envelope(-120, 20, -100, 40);
MyMap.Extent = envelope;

 

Zoom(factor) method

Zoom in or out based on the factor (ratio) provided.

> 1 = zoom in

< 1 = zoom out

See the following code:

 

 
MyMap.Zoom(2);

 

ZoomTo(geometry) method

Zoom to an extent that includes the ESRI.ArcGIS.Client.Geometry passed to the method. The geometry cannot be of type MapPoint. Map animation operates during the extent change. See the following code:

 

 
MyMap.ZoomTo(myPolygon);

 

ZoomToResolution(double) method

Zoom to a resolution defined as the number of map units per pixel. If you know the number of screen pixels per inch (for example, dots per inch [dpi] or pixels per inch [ppi]), you can accurately calculate map scale for the respective client. See the following code:

 

 
TiledMapServiceLayer tiledLayer = 
MyMap.Layers["StreetMapLayer"] as TiledMapServiceLayer;
Lod lod = tiledLayer.TileInfo.Lods[5];
MyMap.ZoomToResolution(lod.Resolution);

 

PanTo(geometry) method

Pan to an extent that centers on the ESRI.ArcGIS.Client.Geometry instance passed to the method. The map scale will not change. Map animation operates during the operation. See the following code:

 

 
MyMap.PanTo(myPoint);
posted @ 2013-09-10 00:30  文刀三石  阅读(423)  评论(0编辑  收藏  举报