tags:

views:

192

answers:

0

I want to latitude/longitude into X,Y coordinates in flash, So i tried these methods by googling.

Please can someone tell me some other way to calculate. because its not showing the expected places

    public function getPoint(lat, lon) {
// First method
                /*stationX = (180+lon) * (mapwidth / 360);
                stationY = (90-lat) * (mapheight / 180);*/
// Second method
                lat = (lat * -1) + 90;
                lon+=180;
                stationX = p.TnMap.x+Math.round(lon * (mapwidth / 360))+ 50;
                stationY = p.TnMap.y+Math.round(lat * (mapheight / 180));
// Thirdmethod
                /*stationX = radius_of_world * Math.cos(lon) * Math.cos(lat);
                stationY = radius_of_world * Math.sin(lon) * Math.cos(lat);
                stationZ = radius_of_world * Math.sin(lat);
                stationX = stationX * 150 / (150 + stationZ);
                stationY = stationY * 150 / (150 + stationZ);*/
            }