Page 1 of 1

maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:29 pm
by cspare
The coordinates given in the maps/Classic_Shape.xml file dont seem to match those on the .jpg files (maps/Classic_Shapes.L.jpg).
I've drawn the coordinates from the xml in the jpg here:
Image
red: n1, blue: a1 green: o4
as you can see they don't line up. Any idea why and how to determine the correct jpg coords for the giving xml coords?

Re: maps/Classic_Art.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:37 pm
by Optimus Prime
Ummm... that doesn't look anything like the XML should look on the map. Are you sure you did it right? Not to mention, you have the Classic Shapes map image, not the Classic Art one.

EDIT: I just went and looked at both maps in active games where the XML was generating army numbers. They look right to me.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:42 pm
by ZeakCytho
Since the 88s display fine on the map, I think the problem must be in how you plotted your coordinates.

Re: maps/Classic_Art.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:48 pm
by cspare
Optimus Prime wrote:Ummm... that doesn't look anything like the XML should look on the map. Are you sure you did it right? Not to mention, you have the Classic Shapes map image, not the Classic Art one.

EDIT: I just went and looked at both maps in active games where the XML was generating army numbers. They look right to me.

I accidentally wrote classic art instead of classic shapes in my post, i checked both the xml with the jpg for classic shapes.
The problem isn't visible in the CC site itself, games are showing the maps correctly. The problem I'm having is when doing the xml coordinates mapping myself.

For example what I did to draw the red line:
From the XML:
<territory>
<name>N1</name>
<borders>
<border>N2</border>
<border>N5</border>
<border>A12</border>

</borders>
<coordinates>
<smallx>46</smallx>
<smally>86</smally>
<largex>57</largex>
<largey>98</largey>

</coordinates>
</territory>

So the Coordinates are: X: 57 and Y: 98
I then simply draw a line with that coordinates on the jpg i downloaded with the result as i posted before.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:52 pm
by gimil
http://www.conquerclub.com/mapmaker/index.php

There is no problem with the current coordinates. All numbers are generated from the XML file on http://www.conquerclub.com/maps So if they appear correct ingame and on the map tool then they are correct on the XML.

This must be a purly human error this time round :)

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 12:55 pm
by cspare
gimil wrote:http://www.conquerclub.com/mapmaker/index.php

There is no problem with the current coordinates. All numbers are generated from the XML file on http://www.conquerclub.com/maps So if they appear correct ingame then they are correct on the XML.

This must be a purly human error this time round :)

Yea i know. human error seems most likely but I don't see what I am doing wrong. In fact I still am expecting for something like the Y coordinates from the XML have to be subtracted by an offset 30 pixels.

edit: to clarify, the X coordinates are always accurate, but the Y coordinates are exactly 30 pixels off. I also checked this with the World 2.1 map with the same result, so I guess it goes for all maps.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:32 pm
by MrBenn
The coordinates are for the centre of the army number... and they start from the top left ;-)

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:42 pm
by cspare
MrBenn wrote:The coordinates are for the centre of the army number... and they start from the top left ;-)

Hmm I'm not sure I understand. The Y coordinates don't really seem to be in the center of anything. Also the X coordinates are just a bit off to be the center. You can see it here:
Image
This is a similar image as I posted before, but now with actual army numbers. I resized it 200% to make it easier to see.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:44 pm
by ZeakCytho
It is possible that you have your x and y coords flippped? The coordinates you showed in the sample look like they could be okay if you flip the x and y.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:49 pm
by chipv
I'm also interested in the answer to this. I had the exact same problem when plotting my highlights for the Turn Watch maps.

I ended up having offsets of 8 for x and 33 for y.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:50 pm
by cspare
ZeakCytho wrote:It is possible that you have your x and y coords flippped? The coordinates you showed in the sample look like they could be okay if you flip the x and y.

Nah, then the green line (from the startpost) for O4 wouldn't have been possible as the map is wider than tall.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:55 pm
by chipv
Ah, wait a sec- what are the dimensions of the territory number graphics? (88 etc)

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 3:58 pm
by cspare
chipv wrote:I'm also interested in the answer to this. I had the exact same problem when plotting my highlights for the Turn Watch maps.

I ended up having offsets of 8 for x and 33 for y.

Yea I guess I'll have to go for that solution as well. I can't really understand how I seem to be the first one asking this while mapmakers are making these XML files all the time. They would have to be aware of the offset, right?

chipv wrote:Ah, wait a sec- what are the dimensions of the territory number graphics? (88 etc)

I was thinking about that too yea. but then these graphics have to be about 2 or 4 times (if the y coordinate is really the center of the graphic) its visible size. And I've never seen any army count wrapping to a new line.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 4:01 pm
by MrBenn
The centre of an 88 is (8,6), so that explains why one coord would be offset by 8px.

Not too sure about the 33px offset though... although it could be something to do with a blank space above the map - that is sometimes filled with tournament descriptions?

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 4:04 pm
by chipv
Well, the offsets are related to the size of the object positioned, which is why I was asking for the 88 size.
As MrBenn says you have to measure from top left.

So my offsets are ok with the divs I was using.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 4:58 pm
by cspare
Ok I did some brainstorming with chipv and got the following conclusion: The top-left coordinates of the image is in fact (x, y) -4, 22. So this would have to be the offset for calculating from XML files to images and the other way around.
example given a coordinate from an XML file:
Code: Select all
   <territory>
      <name>N1</name>
      <borders>
         <border>N2</border>
         <border>N5</border>
         <border>A12</border>

      </borders>
      <coordinates>
         <smallx>46</smallx>
         <smally>86</smally>
         <largex>57</largex>
         <largey>98</largey>

      </coordinates>
   </territory>

The coordinates in the jpg images will be: x: 57 + 4 = 61 and y: 98 - 22

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 5:04 pm
by chipv
To relate this with offsets, the 33 offset comes from the following:

My div is 23px high. To move it to the top left of the centre should require shifting by 23/2 =~ 11.

22(y offset) + 11 = 33

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 5:07 pm
by Gilligan
Well, here's my two cents...

When working on the XML for WWII Europe, I went through it all only to find out that they were completely wrong. The X value was two too big, and the Y value was something like 24 too small, so I had to go back and add/subtract the respective numbers for each territory. Seems to be the same with others too.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Fri Jan 09, 2009 5:46 pm
by MrBenn
Jota's Map Assistant must take the shift into account... I've never had a problem with it, except for it's imprecision... which I have devised a work-around for: viewtopic.php?f=127&t=74500

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Sun Jan 11, 2009 2:15 am
by oaktown
MrBenn wrote:Jota's Map Assistant must take the shift into account... I've never had a problem with it, except for it's imprecision... which I have devised a work-around for: viewtopic.php?f=127&t=74500

Indeed, Jota's map assist gets it right. On the first map I made I tried doing the XML using coordinates generated from within Photoshop, and it came out all skewed. The first thread in which I remember this being discussed is here...

viewtopic.php?f=127&t=14299&p=265339&hilit=coordinates#p265339

Note that at the time we came up with +22 Y and -4 X for shifts.

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Sun Jan 11, 2009 7:45 pm
by chipv
What is the extra shift in the y-axis for? 25 pixels is used for something.

For an 8x6 territory number image, we would ordinarily need to shift by -4 and -3

Well we have -4 in the x axis but a +22 in the y axis meaning a total shift of 25px.

The Tournament label that goes above it is not measured in absolute pixels (try changing the page text size).

Re: maps/Classic_Shape.xml coordinates seem off

PostPosted: Tue Jan 13, 2009 3:56 am
by yeti_c
Ya - this offset is also in BOB.

C.