API talk:Maps

From Guild Wars 2 Wiki
Jump to navigationJump to search

Basic Question[edit]

I am trying to combine the code here: http://jsfiddle.net/CRRGC/1094/
and here: https://fiddle.jshell.net/hackedd/fojfyho1/
to display a clean map using the GW2 icons for Waypoints & POI.
I have been unable to do so. I would like some guidance on how to reference the GW2 icons in the first code or a webpage that would assist me in doing so. Separ (talk) 01:50, 3 August 2016 (UTC)

Converting coords for different zoom levels[edit]

Writing a PHP CLI script to build images of the map in different zoom levels for printing.
I'm fetching all tiles for each zoom level, and then getting the names and coordinates for all waypoints and pois.
My biggest issue now is when the script has merged all tiles to one big map, how do I convert the coordinates to a position?
Since the Tyria map is 49152x49152 units and my level 3 zoom map (merged) is 2560x2560 pixels I've done like this, with originalWidth & originalHeight refering to the width and height of the continent:

scaleFactorX = mapWidth / originalWidth
scaleFactorY = mapHeight / originalHeight

coordX = originalX * scaleFactorX
coordY = originalY * scaleFactorY

And it somewhat works. The icons are correctly positioned in relation to each other, but not in relation to the map size.
Where am I going wrong with this? --IzaacJ (talk) 09:42, 31 March 2018 (UTC)