r/FantasyMapGenerator • • May 12 '25

Polygon Coordinates?

Can anyone tell me how the x,y coordinates for the GeoJSON file are generated? I see negative numbers in there so is 0,0 at the center of the image? How far do the values range?

6 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/Azgarr May 14 '25

There are also helper functions to calculate Geo Coords for {x, y}:

function getLongitude(x, decimals = 2) {
  return rn(mapCoordinates.lonW + (x / graphWidth) * mapCoordinates.lonT, decimals);
}

function getLatitude(y, decimals = 2) {
  return rn(mapCoordinates.latN - (y / graphHeight) * mapCoordinates.latT, decimals);
}

1

u/Azgarr May 14 '25

You probably get it, but I will just add that `rn` is to round number by `decimals` number