<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AMapGetCoordinatesForPoint</id>
	<title>API:MapGetCoordinatesForPoint - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AMapGetCoordinatesForPoint"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:MapGetCoordinatesForPoint&amp;action=history"/>
	<updated>2026-10-18T06:58:49Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:MapGetCoordinatesForPoint&amp;diff=30598&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:MapGetCoordinatesForPoint&amp;diff=30598&amp;oldid=prev"/>
		<updated>2026-10-16T19:47:08Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Map}}&lt;br /&gt;
Converts a position inside a map window into map coordinates (the coordinates of the place shown at that point).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
x, y = MapGetCoordinatesForPoint(mapDisplayName, pointX, pointY)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;mapDisplayName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of a MapDisplay window set up with [[API:CreateMapInstance|CreateMapInstance]].&lt;br /&gt;
;pointX, pointY : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Position inside the window, relative to its top-left corner, in unscaled interface units.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
;x, y : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Coordinates of that point on the map shown in the window. Nothing is returned if either coordinate would be 0 or less, for example when the point is outside the map.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* This is the reverse of [[API:MapGetPointForCoordinates|MapGetPointForCoordinates]].&lt;br /&gt;
* If the window does not exist or is not a MapDisplay, an error is logged, and the conversion is still attempted with the given name. With an empty name, the window check is skipped.&lt;br /&gt;
* If the client&amp;#039;s map data is not loaded, the function returns nothing.&lt;br /&gt;
* The stock world map divides the mouse offset by &amp;lt;code&amp;gt;InterfaceCore.GetResolutionScale()&amp;lt;/code&amp;gt; before calling it, and shows &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt; when nothing is returned.&lt;br /&gt;
* The function needs at least three arguments and only reads the last three.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
These are written to the UI log; the call continues.&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;MapGetCoordinatesForPoint&amp;#039;: Display Window %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;MapGetCoordinatesForPoint&amp;#039;: Display Window %s is not a MapDisplay&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
From &amp;lt;code&amp;gt;default/ea_worldmapwindow/source/zoneview.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function EA_Window_WorldMap.UpdateCoordinates()&lt;br /&gt;
    local mapPositionX, mapPositionY = WindowGetScreenPosition(&amp;quot;EA_Window_WorldMapZoneViewMapDisplay&amp;quot;)&lt;br /&gt;
    local resolutionScale = InterfaceCore.GetResolutionScale()&lt;br /&gt;
    local x, y = MapGetCoordinatesForPoint(&amp;quot;EA_Window_WorldMapZoneViewMapDisplay&amp;quot;,&lt;br /&gt;
                                           (SystemData.MousePosition.x - mapPositionX) / resolutionScale,&lt;br /&gt;
                                           (SystemData.MousePosition.y - mapPositionY) / resolutionScale)&lt;br /&gt;
&lt;br /&gt;
    if (x == nil) then&lt;br /&gt;
        x = L&amp;quot;-&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:MapGetPointForCoordinates|MapGetPointForCoordinates]]&lt;br /&gt;
* [[API:CreateMapInstance|CreateMapInstance]]&lt;br /&gt;
* [[API:MapSetMapView|MapSetMapView]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>