How to get the size in yards of a given map? - WoWInterface
08-18-08, 11:55 AM   #1
Duugu

Join Date: Nov 2006
Posts: 851
How to get the size in yards of a given map?

Since GetPlayerMapPosition() returns coordinates for instances with WotLK I'm current playing around with the coordinates and range checks.

My goal is to calculate the distance between the player and a specific unit in yards.

I realized that GetPlayerMapPosition() returns "the unit position relative to WorldMapDetailFrame". A number between 0 and 1.
So I used GetPlayerMapPosition() to get PlayerX, PlayerY and TargetX, TargetY.

So far so good. But how do I get the range in yards from this data? I've found the Astrolabe and LibTourist libs. Both calculate distances in yards based on GetPlayerMapPosition and additional tables with the size in yards of all zones.
eg. from Astrolabe:
Code:
```Ashenvale = {
height = 3843.722811451077,
width = 5766.728884700476,
...
}```
So this is exactly what I need. But where the hell do I get these data from?
I've searched around for hours, did tests with map viewers, mpq data, looked at WorldMapFrame.lua, etc., etc. But I can't find any way to get, query or calculate the map size of a given map in yards.

I would really appreciate any help/idea on this topic.

08-19-08, 02:46 PM   #2
Duugu

Join Date: Nov 2006
Posts: 851
No one? No even an idea?

08-19-08, 03:42 PM   #3
Freki
A Deviate Faerie Dragon

Join Date: Jan 2005
Posts: 18
Well, if you're looking for ideas, I have an idea to work with (that could potentially be wrong :P). And since I'm bored and have way too much time on my hands, I made an image to illustrate

30 yards would be a measured distance (how? cast range maybe?) and at each end you get the coordinate. In this case, you get a distance of 30 yards between (30,40) and (30,45), meaning there was a change in 10% in the x-axis and a chance of 5% in the y-axis.

Oh, and my math could be completely wrong... hopefully it sparks an idea though!

08-19-08, 03:59 PM   #4
A Pyroguard Emberseer

Join Date: Dec 2006
Posts: 2,302
I don't know if this will help but I'm going to post it anyway.

TomTom can measure how far you are away from a way point in yards (or meters? I don't remember atm), you could look through TomTom's code, find how Clad coded it, and then rewrite it to suite your needs.
__________________

Funtoo - Plan 9 - Windows 7

08-19-08, 04:09 PM   #5
Duugu

Join Date: Nov 2006
Posts: 851
Thanks a lot for your reply Freki. Didn't checked the math, but I understand the idea. Actually this could be a way to get the zone size.

However this means I (and a second "surveying" character) will have to visit all individual zones, which will be very time-consuming. :/

Anyway ... I'll do that if I can't figure out a easier way. Thanks again.

Last edited by Duugu : 08-19-08 at 04:12 PM.

08-19-08, 04:11 PM   #6
Duugu

Join Date: Nov 2006
Posts: 851
 Originally Posted by Dreadlorde TomTom can measure how far you are away from a way point in yards (or meters? I don't remember atm), you could look through TomTom's code, find how Clad coded it, and then rewrite it to suite your needs.
Thanks Dreadlorde. Clad is using the Astrolabe lib. Astrolabe is the lib I took the example data in my initial post from.
Unfortunately I can't use Astrolabe as the lib has no data for WotLK or instances.

Last edited by Duugu : 08-19-08 at 04:13 PM.

08-19-08, 04:23 PM   #7
SDPhantom
A Pyroguard Emberseer

Join Date: Jul 2006
Posts: 1,928
One thing to note.
Last I checked, casting range takes altitude into fact.
You might want to make sure both measuring points are on even ground.
__________________
 "All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools." -Anders (Dragon Age: Origins - Awakening)

08-19-08, 04:57 PM   #8
Freki
A Deviate Faerie Dragon

Join Date: Jan 2005
Posts: 18
Cast range was just the first thing that popped into my mind. I'd hope that there would be a more precise way to measure it. You could always try sending a message to the author of Astrolabe (Esamynn) to see how he/she did it.

08-19-08, 05:20 PM   #9
ra1d3n
A Cyclonian

Join Date: Jun 2006
Posts: 44
 Originally Posted by Duugu Thanks Dreadlorde. Clad is using the Astrolabe lib. Astrolabe is the lib I took the example data in my initial post from. Unfortunately I can't use Astrolabe as the lib has no data for WotLK or instances.
Did you ever think about that they may have opened the map files with a viewer and looked up the size directly?
That is probably the reason the size is hardcoded.

08-19-08, 05:27 PM   #10
SDPhantom
A Pyroguard Emberseer

Join Date: Jul 2006
Posts: 1,928
 Originally Posted by ra1d3n Did you ever think about that they may have opened the map files with a viewer and looked up the size directly?
 Originally Posted by Duugu ... I've searched around for hours, did tests with map viewers, mpq data, looked at WorldMapFrame.lua, etc., etc. But I can't find any way to get, query or calculate the map size of a given map in yards. ...
__________________
 "All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools." -Anders (Dragon Age: Origins - Awakening)

08-19-08, 07:46 PM   #11
ra1d3n
A Cyclonian

Join Date: Jun 2006
Posts: 44
 Originally Posted by SDPhantom Question answered...