Jump to content
  • Sign Up

Translating Mumble coordinates to API:2/maps coordinates


Recommended Posts

Hello there

I am struggling to translate the coordinates provided by the mumble file into ones that match the coordinate system used by the API:2/maps.More precisely, I am working with the coordinates from TacO files which are based on the mumble coordinates.

The mumble coordinates seem to be relative to the current map while the maps API provides coordinates for an entire continent.So what I tried is to add a maps continent_rect NW x and y values to the map relative coordinates from mumble.The resulting coordinates are offset though. It appears that the map relative coordinates are not based on the maps NW corner but some seemingly random spot somewhere in the maps middle.

So I tried to calculate the maps center point using the API:2/maps coordinate_rect information.This almost matches for coordinates in Lions Arch, for example Spirit Vale is waaay off though. So again, it appears to be random as to where the mumble file coordinates are based on.

What am I missing?

Link to post
Share on other sites

The wiki has a article explaining coordinates: https://wiki-en.guildwars2.com/wiki/API:Maps

To convert map to continent coordinates you can use something like this:

function mapCoordinateToContinent(coordinate, map) {    const cmin = map.continent_rect[0];    const cmax = map.continent_rect[1];    const mapMin = map.map_rect[0];    const mapMax = map.map_rect[1];    return [        cmin[0] + (cmax[0] - cmin[0]) * ((coordinate[0] - mapMin[0]) / (mapMax[0] - mapMin[0])),        cmin[1] + (cmax[1] - cmin[1]) * ((coordinate[1] - mapMin[1]) / (mapMax[1] - mapMin[1]))    ];}

You also have to convert the Mumble units to map units:

const continentCoordinates = mapCoordinateToContinent([marker.xpos * 39.37, -marker.zpos * 39.37], maps[marker.MapID]);
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...