Exemple #1
0
    public String convertLatLonToUTM(double latitude, double longitude)
    {
        validate(latitude, longitude);
        String UTM = "";

        setVariables(latitude, longitude);

        String   longZone = getLongZone(longitude);
        LatZones latZones = new LatZones();
        String   latZone  = latZones.getLatZone(latitude);

        double _easting  = getEasting();
        double _northing = getNorthing(latitude);

        UTM = longZone + " " + latZone + " " + ((int)_easting) + " "
              + ((int)_northing);
        // UTM = longZone + " " + latZone + " " + decimalFormat.format(_easting) +
        // " "+ decimalFormat.format(_northing);

        return(UTM);
    }
            public string convertLatLonToUTM(double latitude, double longitude)
            {
                validate(latitude, longitude);
                string UTM = "";

                setVariables(latitude, longitude);

                string longZone = getLongZone(longitude);
                LatZones latZones = new LatZones();
                string latZone = latZones.getLatZone(latitude);

                double _easting = getEasting();
                double _northing = getNorthing(latitude);

                UTM = longZone + " " + latZone + " " + ((int)_easting) + " " + ((int)_northing);
                // UTM = longZone + " " + latZone + " " + decimalFormat.format(_easting) +
                // " "+ decimalFormat.format(_northing);

                return UTM;
            }
            public string convertLatLonToMGRUTM(double latitude, double longitude)
            {
                validate(latitude, longitude);
                String mgrUTM = "";

                setVariables(latitude, longitude);

                string longZone = getLongZone(longitude);
                LatZones latZones = new LatZones();
                string latZone = latZones.getLatZone(latitude);

                double _easting = getEasting();
                double _northing = getNorthing(latitude);
                Digraphs digraphs = new Digraphs();
                string digraph1 = digraphs.getDigraph1(int.Parse(longZone),
                    _easting);
                string digraph2 = digraphs.getDigraph2(int.Parse(longZone),
                    _northing);

                string easting = ((int)_easting) + "";
                if (easting.Length < 5)
                {
                    easting = "00000" + easting;
                }
                easting = easting.Substring(easting.Length - 5);

                string northing;
                northing = ((int)_northing) + "";
                if (northing.Length < 5)
                {
                    northing = "0000" + northing;
                }
                northing = northing.Substring(northing.Length - 5);

                mgrUTM = longZone + latZone + digraph1 + digraph2 + easting + northing;
                return mgrUTM;
            }