真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

經(jīng)緯度定位java代碼,java 經(jīng)緯度

java代碼實(shí)現(xiàn)如何獲取當(dāng)前經(jīng)緯度?

安卓的話可以用GPS取。

成都創(chuàng)新互聯(lián)公司是一家網(wǎng)站設(shè)計公司,集創(chuàng)意、互聯(lián)網(wǎng)應(yīng)用、軟件技術(shù)為一體的創(chuàng)意網(wǎng)站建設(shè)服務(wù)商,主營產(chǎn)品:自適應(yīng)網(wǎng)站建設(shè)、成都品牌網(wǎng)站建設(shè)、成都全網(wǎng)營銷推廣。我們專注企業(yè)品牌在網(wǎng)站中的整體樹立,網(wǎng)絡(luò)互動的體驗(yàn),以及在手機(jī)等移動端的優(yōu)質(zhì)呈現(xiàn)。網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計、移動互聯(lián)產(chǎn)品、網(wǎng)絡(luò)運(yùn)營、VI設(shè)計、云產(chǎn)品.運(yùn)維為核心業(yè)務(wù)。為用戶提供一站式解決方案,我們深知市場的競爭激烈,認(rèn)真對待每位客戶,為客戶提供賞析悅目的作品,網(wǎng)站的價值服務(wù)。

import?android.app.Activity;

import?android.os.Bundle;

import?android.location.*;

import?android.content.*;

import?android.util.Log;

import?android.widget.TextView;

public?class?GPSLocationListenActivity?extends?Activity?implements?LocationListener?{

LocationManager?locman;

/**?Called?when?the?activity?is?first?created.?*/

@Override

public?void?onCreate(Bundle?savedInstanceState)?{

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

locman?=?(LocationManager)getSystemService(Context.LOCATION_SERVICE);

}

@Override

protected?void?onResume(){

if?(locman?!=?null){

locman.requestLocationUpdates(LocationManager.GPS_PROVIDER,?0,0,this);??????????

}

super.onResume();

}

@Override

protected?void?onPause(){

if?(locman?!=?null){

locman.removeUpdates(this);

}

super.onPause();

}

@Override

public?void?onLocationChanged(Location?location){

TextView?textView1?=?(TextView)findViewById(R.id.textView1);

textView1.setText("Latitude:Longitude?-?"

+String.valueOf(location.getLatitude())?+":"+String.valueOf(location.getLongitude()));

TextView?textView2?=?(TextView)findViewById(R.id.textView2);

textView2.setText(String.valueOf(location.getTime()));

Log.v("----------",?"----------");

Log.v("Latitude",?String.valueOf(location.getLatitude()));

Log.v("Longitude",?String.valueOf(location.getLongitude()));

Log.v("Accuracy",?String.valueOf(location.getAccuracy()));

Log.v("Altitude",?String.valueOf(location.getAltitude()));

Log.v("Time",?String.valueOf(location.getTime()));

Log.v("Speed",?String.valueOf(location.getSpeed()));?

Log.v("Bearing",?String.valueOf(location.getBearing()));

}

@Override

public?void?onProviderDisabled(String?provider){

}

@Override

public?void?onProviderEnabled(String?provider){

}

@Override

public?void?onStatusChanged(String?provider,?int?status,?Bundle?extras){

switch(status){

case?LocationProvider.AVAILABLE:

Log.v("Status","AVAILABLE");

break;

case?LocationProvider.OUT_OF_SERVICE:

Log.v("Status","OUT_OF_SERVICE");

break;

case??LocationProvider.TEMPORARILY_UNAVAILABLE:

Log.v("Status","TEMPORARILY_UNAVAILABLE");

break;

}

}

}

求JAVA經(jīng)緯度轉(zhuǎn)換代碼

由于鍵盤上沒有 ° 鍵,所以我在程序中把它換成 * 鍵了。

運(yùn)行下面程序,從控制臺輸入 40582974 ,回車 ,輸出結(jié)果:22*32.7658′

輸入:57335948

輸出:31*51.1983'

import java.math.BigDecimal;

import java.util.Scanner;

public class LatitudeTransform {

public static void main(String[] args) {

Scanner sca = new Scanner(System.in);

String in = sca.nextLine();

//將控制臺接收到的輸入轉(zhuǎn)成數(shù)字

long num = Long.parseLong(in);

//利用整除舍棄余數(shù)得到度數(shù)值

long du = (num / 30000) / 60;

//將控制臺接收到的數(shù)值除以30000,得到度和分的混合結(jié)果,再對60取余,得到分的部分

BigDecimal fen = new BigDecimal(num).divide(new BigDecimal(30000), 4, BigDecimal.ROUND_HALF_UP).remainder(

new BigDecimal(60));

System.out.println(du + "*" + fen + "'");

}

}

下面的部分是,在控制臺輸入22°32.7658′ ,回車得到40582974。開始的時候讀你的問題理解反了,所以先寫的這個,也給你吧,要是沒用就算了~呵呵。

import java.util.Scanner;

public class LatitudeTransform {

public static void main(String[] args) {

Scanner sca = new Scanner(System.in);

String in = sca.nextLine();

String result = transform(in);

System.out.println(result);

}

private static String transform(String in) {

//將輸入的字符串分成兩截,分別為度數(shù)du_string,分?jǐn)?shù)fen_string

String du_string = in.substring(0, in.indexOf("*"));

//substring方法兩個參數(shù)遵循規(guī)則"前包含后不包含",例,”1234“.substring(0,2)返回的結(jié)果是index為0到1的子串,即"12"

String fen_string = in.substring(in.indexOf("*") + 1, in.indexOf("'"));

double du = Double.parseDouble(du_string);

double fen = Double.parseDouble(fen_string);

Long result = (long) ((du * 60 + fen) * 30000);

return result.toString();

}

}

經(jīng)緯度轉(zhuǎn)平面坐標(biāo)系java代碼

定一個原點(diǎn)。 定一個比例尺 然后根據(jù)點(diǎn)與原點(diǎn)的距離,得到坐標(biāo),再通過與原點(diǎn)的坐標(biāo)比,得到距離,再轉(zhuǎn)成經(jīng)緯度

求java代碼,手機(jī)獲取當(dāng)前GPS的經(jīng)緯度。

記得我前幾天發(fā)過一個類似的代碼如下(適用安卓)

import?android.app.Activity;

import?android.os.Bundle;

import?android.location.*;

import?android.content.*;

import?android.util.Log;

import?android.widget.TextView;

public?class?GPSLocationListenActivity?extends?Activity?implements?LocationListener?{

LocationManager?locman;

/**?Called?when?the?activity?is?first?created.?*/

@Override

public?void?onCreate(Bundle?savedInstanceState)?{

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

locman?=?(LocationManager)getSystemService(Context.LOCATION_SERVICE);

}

@Override

protected?void?onResume(){

if?(locman?!=?null){

locman.requestLocationUpdates(LocationManager.GPS_PROVIDER,?0,0,this);??????????

}

super.onResume();

}

@Override

protected?void?onPause(){

if?(locman?!=?null){

locman.removeUpdates(this);

}

super.onPause();

}

@Override

public?void?onLocationChanged(Location?location){

TextView?textView1?=?(TextView)findViewById(R.id.textView1);

textView1.setText("Latitude:Longitude?-?"

+String.valueOf(location.getLatitude())?+":"+String.valueOf(location.getLongitude()));

TextView?textView2?=?(TextView)findViewById(R.id.textView2);

textView2.setText(String.valueOf(location.getTime()));

Log.v("----------",?"----------");

Log.v("Latitude",?String.valueOf(location.getLatitude()));

Log.v("Longitude",?String.valueOf(location.getLongitude()));

Log.v("Accuracy",?String.valueOf(location.getAccuracy()));

Log.v("Altitude",?String.valueOf(location.getAltitude()));

Log.v("Time",?String.valueOf(location.getTime()));

Log.v("Speed",?String.valueOf(location.getSpeed()));?

Log.v("Bearing",?String.valueOf(location.getBearing()));

}

@Override

public?void?onProviderDisabled(String?provider){

}

@Override

public?void?onProviderEnabled(String?provider){

}

@Override

public?void?onStatusChanged(String?provider,?int?status,?Bundle?extras){

switch(status){

case?LocationProvider.AVAILABLE:

Log.v("Status","AVAILABLE");

break;

case?LocationProvider.OUT_OF_SERVICE:

Log.v("Status","OUT_OF_SERVICE");

break;

case??LocationProvider.TEMPORARILY_UNAVAILABLE:

Log.v("Status","TEMPORARILY_UNAVAILABLE");

break;

}

}

}

之前的提問鏈接


當(dāng)前標(biāo)題:經(jīng)緯度定位java代碼,java 經(jīng)緯度
本文路徑:http://weahome.cn/article/hdijio.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部