5 Replies Latest reply on Mar 15, 2012 7:01 PM by John Hawkinson

    How to find out the coordinates of pageitems

    Mrs_Calahan

      Hi,

       

      I designed a demo file in Indesign with a rectangle.

       

      Pagesize: 85mm x 55mm

      Rectangle: x=42,375mm, y=27,458mm, width: 58,417mm, height=28,417mm

       

      In the next step I did an idml export.

       

      Spread.xml:

      ...
      <Rectangle Self="ud8" ... ItemTransform="1 0 0 1 0 0"> 
          <Properties> 
               <PathGeometry> 
                  <GeometryPathType PathOpen="false"> 
       <PathPointArray> 
       <PathPointType Anchor="-82.6496062992126 -39.893700787401585" LeftDirection="-82.6496062992126 -39.893700787401585" RightDirection="-82.6496062992126 -39.893700787401585"/> 
       <PathPointType Anchor="-82.6496062992126 39.65748031496063" LeftDirection="-82.6496062992126 39.65748031496063" RightDirection="-82.6496062992126 39.65748031496063"/> 
       <PathPointType Anchor="81.94094488188978 39.65748031496063" LeftDirection="81.94094488188978 39.65748031496063" RightDirection="81.94094488188978 39.65748031496063"/> 
       <PathPointType Anchor="81.94094488188978 -39.893700787401585" LeftDirection="81.94094488188978 -39.893700787401585" RightDirection="81.94094488188978 -39.893700787401585"/> 
       </PathPointArray> 
      ... 
      

       

      I do not understand how to calculate the  x, y  coordinates which are shown in indesign!?

      I tried to understand the matrix calculation which is described in the IDML reference on page 98. http://wwwimages.adobe.com/...ml-specification.pdf

       

      | a b 0 |    | x |            | 1 0 0 |      | -82.6496062992126    |             | -82.6496062992126    |

      | c d 0 | *  | y |     -->   | 0 1 0 |  *  | -39.893700787401585 |    -->     | -39.893700787401585 |

      | e f  1 |    | 1 |            | 0 0 1 |     | 1                               |              | 1                               |

       

      :-(   That does not correspond to the display coordinates in Indesign   ( x=42,375mm, y=27,458mm)

       

       

      Can anybody help?

      THANKS!

        • 1. Re: How to find out the coordinates of pageitems
          John Hawkinson Level 5

          Screenshot of the ID UI with the coordinates displayed is probably a good idea here so we can see what you're talking about.

          But fundamentally, IDML coordinates are in pasteboard-relative points with a zero point in the upper left.

          In the ID UI, the zero point is elsewhere, depending. It may be custom, spine-relative, or page-relative.

          So you'll need to apply a translation to the zero point.

          • 2. Re: How to find out the coordinates of pageitems
            Mrs_Calahan Level 1

            Yes but I don't understand how to translate the coordinates to zero point.

             

            Here ist the screen. The rectangle is the green area.

            ID_UI.jpg

            • 3. Re: How to find out the coordinates of pageitems
              John Hawkinson Level 5

              It seems pretty straightforward to me.

              Your center point is (42.375 mm, 27.458 mm) and your box is 58.417 mm x 28.417mm.

              IDML defines the rectangle by its corners, not its center, so let's find the upper-left corner. Divide the width by two and subtract from the x, same for the height and the y. You get (13.665 mm, 13.2495 mm).

              That is in page coordinates relative to the upper-left corner of the page, we can see from your rulers.

               

              But IDML coordinates are spread-relative from the center of the spread. Your spread is a single page that is 85 mm x 55 mm.

              So if we translate your upper-left corner, it is (13.665, 13.2495) mm - (85/2, 55/2) => (29.3335 mm, 14.2505mm) in spread-relative coordinates.

               

              But IDML coordinates are in points, not in mm. So we convert (multiply by 2.835). And we get (83.150 pt, 40.395 pt).

              But that doesn't match up with your IDML file, which has  (-82.650 pt, -39.890pt).

              But look at the difference: (0.500 pt, 0.505 pt). That's really 1/2 point, because your box has a 1-pt border and that gets split evenly across all 4 sides. And there's 0.005 of round-off error, bceause floating point math sucks.

               

              Any questions?

              • 4. Re: How to find out the coordinates of pageitems
                [Jongware] Most Valuable Participant

                John Hawkinson wrote:

                 

                ..  And there's 0.005 of round-off error, bceause floating point math sucks.

                 

                Actually, InDesign's floating point calculations have a mind-blowing accuracy -- I'd have to look it up, but I think it was about 10 significant decimals after the decimal point. With its internal measurements in points, that's in mm accurate to about 3.5E-11 mm -- ten times smaller than the wavelength of visible light, so even when there are rounding errors, they won't be "visible"

                 

                The measurements you see in the InDesign interface itself are inaccurate; first, because ID shows the result of the conversion from pt to mm, second, because the width of the measurement field is artifically limited to two to four decimal places (depending on the measurement unit). But all values are stored as accurate as possible inside an IDML, in points.

                 

                So when comparing IDML to the original INDD, you are best off switching your on-screen units to points as well. The same goes for the zero-point location; it has a fixed position in IDML, while in InDesign you can drag it anywhere.

                • 5. Re: How to find out the coordinates of pageitems
                  John Hawkinson Level 5

                  Oh, hey! I should acknowledge that my statement in reply #1 was absolutely false:

                   

                   

                  But fundamentally, IDML coordinates are in pasteboard-relative points with a zero point in the upper left.

                  Just not true!