Mapping a point on Earth onto an in-game map

This might be a bit complicated, sorry

There is a map I have made for a Santa Tracker game, and I am not going to sacrifice my soul and place every city individually. I want to know if its possible to make a script to at least help me out (put in city name, coordinates, and it’ll map it).


Picture of the map and some points I placed last year (manually, I want to die)

BTW, map uses the Equirectangular projection

yes, I changed it I miss read. ok um i think you would need to use some sort of data set or api

That’s literally a random map on the toolbox. My map uses the Equirectangular projection, and I need to map maybe 400-500 cities.

yea i saw that after i changed my reply

You can try making a module script, and make a function which lets you set a position/cframe to a part or attachment or any instance with a position and cframe, then you can send in arguments like "Name" and CountryName.

Yeah but that still leaves the question on how you will map coordinates onto the map.

You can use attatchments or small-scalled parts?

Just set there position to the designated cframe thats set by the function.

No, COORDINATES. Real EARTH coordinates. Like mapping 50.680°N 4.412°E onto the map in-game.

That seems extremely hard, never done it before.

Why do you want the EXACT position anyway? RON doesn’t have an exact city location, but its approximately where it should be.

Because I don’t want to map 500 cities manually. And because I like things to be exact.

RoN is a good game tho.

Well that doesn’t sound possible without having to do it manually, unless you have an extremely complex algorithm.

Automation is a very good way to do it, but its not always easy to do in situations like this.

The formulas are given in the Wikipedia article you linked.

Simple geometry tells us that the radius of the sphere this map plane is projecting from would be the width of the map divided by 2PI

radius = mapWidth / 2 * pi

The map is most likely using the equator as the central parrelel so the vertical coordinate becomes

y = radius * longitude

the x coordinate would depend on how the the map picture you have is projected. If the standard parallel were to be 0 (picture width = 2 * picture height) then

x = radius * latitude

It’s not an ‘extremely complex algorithm’ at all:

The function from that Stack Overflow post made into lua:

local function getXY( lat, lng )

local screenX = ((lng + 180) * (mapWidth / 360))
local screenY = (((lat * -1) + 90) * (mapHeight/ 180))

return { X = screenX, Y = screenY }
end

I tried putting the coordinates of Provideniya through the equation, and it came out as the middle of the Atlantic.

Do you know how to fix this error?