How to convert Android GPS coordinates into X,Y coordinates.

Without further math bullshit about all the conversion systems, when you have a bunch of Android GPS coordinates (which are compatible with Google Earth and Google Maps), and you want to draw them on a finite 2D plane, here’s what worked for me.

int x = (int) ((PLANE_WIDTH/360.0) * (180 + lon));
int y = (int) ((PLANE_HEIGHT/180.0) * (90 – lat));

2 thoughts on “How to convert Android GPS coordinates into X,Y coordinates.

  1. Im trying your algorithm but I cannot put this working yet, as the GPS coordinates are in double, when I cast the X and Y to int Im losing information and the integer value remain almost the same….Im putting the PLANE_WIDTH and PLANE_HEIGHT with the resolution of my screen device 320×480, like PLANE_WIDTH=320 and PLANE_HEIGHT=480 . Any tip are more than welcome?

    Here is my code:

    public void convertGPStoCartezian(double longitude, double latitude){
    int x = (int) ((320/360.0) * (180 + longitude));
    int y = (int) ((480/180.0) * (90 – latitude));


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.