Converts points from screen coordinates to map coordinates.
ToMapPoints(MapDescription MapDescription, ImageDisplay MapImageDisplay, int[] ScreenXValues, int[] ScreenYValues)
Parameter |
Description |
MapDescription
|
Used to define map extent in map units.
|
ImageDisplay |
Used to define the map image extent in pixels. |
ScreenXValues |
An integer array containing the X values for coordinates to convert from screen (pixel) to map units.
|
ScreenYValues |
An integer array containing the Y values for coordinates to convert from screen (pixel) to map units.
|
Return Value
A Multipoint object containing one or more coordinates in map units. Each coordinate is stored as a Point object. Note that both Multipoint and Point are abstract definitions, thus you will need to cast to MultipointN and PointN, respectively.
Remarks
The ToMapPoints() method is often used to convert user interaction on a map in a client application to map coordinates for use in other methods. For example, drawing graphics on the map and querying feature layers via user defined geometry.
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 map 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 ToMapPoints method.
Examples