Map service FromMapPoints method

Converts map coordinates to screen coordinates.

FromMapPoints (MapDescription MapDescription, ImageDisplay MapImageDisplay, Multipoint MapPoints, out int[ ] ScreenYValues)




Used to define map extent in map units.


Used to define the map image extent in pixels.


A Multipoint object containing one or more coordinates in map units. Each coordinate is stored as a PointN object.


An integer array containing the Y values for coordinates converted from map to pixel units. The array is populated when the method is called.

Return Value

An integer array containing the X values for coordinates converted from map to pixel units.


To convert between map and pixel units, the origin for both must be determined. The origin for coordinates in map units is located in the lower left corner of the map image. The map origin is the minimum x and y value of the current map extent. The origin for coordinates in pixel units is located in the upper left corner of the map image. The pixel origin is always 0,0.

Note that the map service will maintain aspect ratio, so the map extent provided as part of the MapDescription may be different than the map extent used to generate the pixel coordinates. To get the map extent used in the calculation, call ExportMapImage with the same MapDescription and ImageDisplay (as part of ImageDescription). A MapImage is returned where the Extent property references the map extent used by the FromMapPoints method.



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;


ImageDisplay imgdisp = new ImageDisplay();

imgdisp.ImageHeight = 500; //pixels

imgdisp.ImageWidth = 500; //pixels

imgdisp.ImageDPI = 96;


MultipointN multipoint = new MultipointN();

PointN[] points = new PointN[1];


wsmap.PointN pnt0 = new PointN();

pnt0.X = -120.0;

pnt0.Y = 35.0;


points[0] = pnt0;

multipoint.PointArray = points;


int[] screeny = null;

int[] screenx = mapservice.FromMapPoints(mapdesc, imgdisp, multipoint, out screeny);


Dim mapservice As MapService_MapServer = New MapService_MapServer()

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


Dim mapinfo As MapServerInfo = mapservice.GetServerInfo(mapservice.GetDefaultMapName())

Dim mapdesc As MapDescription = mapinfo.DefaultMapDescription


Dim imgdisp As ImageDisplay = New ImageDisplay()

imgdisp.ImageHeight = 500 'pixels

imgdisp.ImageWidth = 500 'pixels

imgdisp.ImageDPI = 96


Dim multipoint As MultipointN = New MultipointN()

Dim points() As PointN = New PointN(1) {}

Dim pnt0 As wsmap.PointN = New PointN()

pnt0.X = -120.0

pnt0.Y = 35.0

points(0) = pnt0

multipoint.PointArray = points


Dim screeny() As Integer = Nothing

Dim screenx() As Integer = mapservice.FromMapPoints(mapdesc, imgdisp, multipoint, screeny)


String serviceURL = "http://localhost:6080/arcgis/services/MapService/MapServer";

MapServerBindingStub mapService = new MapServerBindingStub(serviceURL);


String mapName = mapService.getDefaultMapName(); 

MapServerInfo mapInfo = mapService.getServerInfo(mapName);

MapDescription mapDesc = mapInfo.getDefaultMapDescription();


ImageDisplay imgDisp = new ImageDisplay();

imgDisp.setImageHeight(500); //Height of the image in pixels

imgDisp.setImageWidth(500); //Width of the image in pixels



PointN[] points = new PointN[1];

PointN pnt0 = new PointN();



points[0] = pnt0;


MultipointN multiPoint = new MultipointN();



Holder<int[]> screenX = new Holder<int[]>();

Holder<int[]> screenY = new Holder<int[]>();


mapService.fromMapPoints(mapDesc, imgDisp, multiPoint, screenX, screenY);

System.out.println("ScreenX: " + screenx.value[0]);

System.out.println("ScreenY: " + screeny.value[0]);