Hello,
I want to project GPS coordinates on a screen of a specific size. This screen must not be representing the entire world map, but a small portion, something like 200 meters x 100 meters at a certain place .
This are my draw() and LatLngtoXY() functions:
void draw()
{
if(newData) {
fill(#FFFFFF, 10);
noStroke();
rect(xCoord, yCoord, rectSizeX, rectSizeY);
}
}
void LatLngtoXY(float lat, float lon) {
float mapWidth = width;
float mapHeight = height;
// get x value
xCoord = (lon+180)*(mapWidth/360);
// convert from degrees to radians
float latRad = lat*PI/180;
// get y value
float mercN = log(tan((PI/4)+(latRad/2)));
yCoord = (mapHeight/2)-(mapWidth*mercN/(2*PI));
}
I got the conversion bit of code online. Now I think that maps the entire world map doesn’t it?
How can I adjust the code so that the trail of blocks that is drawn is shown in a 200meters x 100 meters representation?
Thanks in advance!