kevinlecocq

How to convert map coordinates to page coordinates?

Discussion created by kevinlecocq on Apr 7, 2014
Latest reply on Apr 15, 2014 by kevinlecocq
I have a map inside a page layout in ArcMap. Currently, I use this code to convert geographic coordinates to page coordinates:
IMap map = ...
IPageLayout pageLayout = ...

IDisplayTransformation mapTransformation = ((IActiveView)map).getScreenDisplay().getDisplayTransformation();
IDisplayTransformation pageTransformation = ((IActiveView)pageLayout).getScreenDisplay().getDisplayTransformation();

IPoint mapPoint = ...

int x[] = {0};
int y[] = {0};
mapTransformation.fromMapPoint(mapPoint, x, y);
IPoint pagePoint = pageTransformation.toMapPoint(x[0], y[0]);


The problem of this method is that x[0] and y[0] are device coordinates (integers).
For example, if mapPoint = 913767.624037, 6458100.4284 (in meters)
I get: x[0], y[0] = 18, -2
Then: pagePoint = 18.0, 2.0 (in centimeters)

These values are corrects but they are rounded. I would expect for this example a pagePoint = 18.42 cm, 2.19 cm
Is there another way to get directly map to page coordinates conversion without going through device coordinates?
Or what's wrong in my conversion method?

I would appreciate any help on this problem. Thanks!

Outcomes