CenterAndSize

Base Type: MapArea

A class that defines the center point and size (in map units) of a map.

Property

Type

Description

Center

Point

The location on which to center the map.

Height

double

The height of the map in map units.

Units

string

The map units.

Width

double

The width of the map in map units.

Remarks

This object allows you to change the spatial extent of a map by specifying the center, size and units. To use, create a new object and define a new map extent using a center point, the height and the width of the map. The height and width are in map units. If the spatial reference of the map has changed, remember to adjust the center point coordinates and height and width units accordingly.

NoteNote:

If the aspect ratio defined by this object is different from the aspect ratio of the requested map image, the returned map extent will be adjusted to fit the requested image.

Examples

C#

MapService_MapServer mapService = new MapService_MapServer();

mapService.Url = "http://localhost:6080/arcgis/services/MapService/MapServer";

MapServerInfo mapInfo = mapService.GetServerInfo(mapService.GetDefaultMapName());

MapDescription mapDesc = mapInfo.DefaultMapDescription;

 

ImageType imgType = new ImageType();

imgType.ImageFormat = esriImageFormat.esriImagePNG;

imgType.ImageReturnType = esriImageReturnType.esriImageReturnURL;

 

ImageDisplay imgDisp = new ImageDisplay();

imgDisp.ImageHeight = pictureBox1.Height;

imgDisp.ImageWidth = pictureBox1.Width;

imgDisp.ImageDPI = 96;

 

ImageDescription imgDesc = new ImageDescription();

imgDesc.ImageDisplay = imgDisp;

imgDesc.ImageType = imgType;

 

PointN pointN = new PointN();

pointN.X = -100;

pointN.Y = 35;

 

CenterAndSize centerSize = new CenterAndSize();

centerSize.Center = pointN;

centerSize.Height = 20;

centerSize.Width = 20;

centerSize.Units = mapInfo.Units.ToString();

 

mapDesc.MapArea = centerSize;

 

MapImage mapImage = mapService.ExportMapImage(mapDesc, imgDesc);

2/28/2020