Select to view content in your preferred language

How to convert map coordinates to page coordinates?

741
1
04-07-2014 01:56 AM
KevinLECOCQ
Deactivated User
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!
0 Kudos
1 Reply
KevinLECOCQ
Deactivated User
I already have the problem, up?
0 Kudos