Fyrimynd:Location map/modulo math details
For a map using an equirectangular projection which does not cross +/-180 longitude, or +/-90 latitude, the following expressions can be used:
x = 100*(long - left)/(right - left)
y = 100*(lat - top)/(bottom - top)
where lat and long are the degrees latitude and longitude respectively. Here, top and bottom are the degrees latitude of the top and bottom edges of the map, left and right are the degrees latitude of the left and right edges of the map.
Things are a bit more complicated when the map crosses +/-180 longitude, and some sort of "modulo arithmetic" is required. Here, we add 360 if the longitude is less than 0, then use a mapping based on positive coordinates. The following table can be used to check if the expressions are working as desired:
location | lat | long | (x,y) test | (x,y) exact |
---|---|---|---|---|
top/left | 0 | 0 | (0,0) | |
top/right | 0 | 100 | (100,0) | |
bottom/left | 100 | 0 | (0,100) | |
bottom/right | 100 | 100 | (100,100) | |
center | 50 | 50 | (50,50) |
Lua feilur í Module:Documentation á linju 144: message: type error in message cfg.container (string expected, got nil).