getCoordinateInMap
getCoordinateInMap(
lng: number,
lat: number,
mapCoord: [number, number, number, number],
mapWidth: number,
mapHeight: number,
zoom?: number,
tileSize?: number,
): { x: number; y: number }
Parameters
lng: number
longitute
lat: number
latitude
mapCoord: [number, number, number, number]
MapBox/TileMill map coords array, like [-180,-85.0511,180,85.0511]
mapWidth: number
the map width in pixels
mapHeight: number
the map height in pixels
zoom: number = 1
zoom factor fo this map
tileSize: number = 512
Compute GPS coordinates into pixels x, y coordinates in a map. Here, we adopt the OSM standard for mappinp. Therefore, you should generate your bitmap earth map with a tool using OSM tiles (like MapBox, TileMill). You should give the zoom factor and the map bounds (in lognititude and latitude) to this method for the calculation to be effective