導航:首頁 > 操作系統 > android圖片經緯度

android圖片經緯度

發布時間:2022-12-24 20:55:42

android中集成了百度地圖 有經緯度的坐標怎樣能實現定位

朋友:
網路地圖沒有輸入經緯度進行查詢的功能,

你要不下載一個google地球吧,先定位到某地,在圖的下方就是經緯度 。

❷ 怎麼在android百度地圖通過經緯度來定位並且顯示出地圖位置

可以參考如下內容:

使用Android自帶的LocationManager和Location獲取位置的時候,經常會有獲取的location為null的情況,並且操作起來也不是很方便,在這個Demo里我使用了網路地圖API中的定位SDK,可以一次性獲取當前位置經緯度以及詳細地址信息,還可以獲取周邊POI信息,同時可以設定位置通知點,當到達某一位置時,發出通知信息等方式來告知用戶。jar包下載以及官方文檔請參照:網路定位SDK,前提是需要注冊網路開發者賬號。
下面來看看定位的基本原理,目前,定位SDK可以通過GPS、基站、Wifi信號進行定位。基本定位流程如下圖所示,當應用程序向定位SDK發起定位請求時,定位SDK會根據當前的GPS、基站、Wifi信息生成相對應的定位依據。然後定位SDK會根據定位依據來進行定位。如果需要,定位SDK會向定位伺服器發送網路請求。定位伺服器會根據請求的定位依據推算出對應的坐標位置,然後根據用戶的定製信息,生成定位結果返回給定位SDK。

❸ 高德地圖,android開發中,怎麼用經緯度來顯示地圖

首先創建工程,並在工程Build Path>Configure Build Path…>libraries 中選擇「Add Externel JARs…」,選定

MapApi.jar,點擊OK,這樣就可以將高德地圖Android API 庫文件引入。然後在工程Build Path>Configure Build

Path…>Order and Export 中將引入的庫文件MapApi.jar 選中,點擊OK,這樣您就可以在您的程序中使用高德地圖API

了。

二、我們在不熟悉的情況下、先盡量多的添加此軟體應用許可權;所以在mainifest中添加如下代碼;插入的位置在

<application的代碼之前。

java代碼
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>

三、接著就要在res文件下的layout中添加界面布局了。其代碼如下、你可以完全復制進去。

Java代碼
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!--添加文本輸入框,查找地址-->
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content" android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_gravity="center_horizontal">
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="經度"/>
<EditText android:layout_height="fill_parent"
android:layout_width="100px"
android:id="@+id/longitude"/>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="緯度"/>
<EditText android:layout_height="fill_parent"
android:layout_width="100px"
android:id="@+id/latitude"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="查找"
android:id="@+id/button"/>
</LinearLayout>

<com.amap.mapapi.map.MapView android:id="@+id/mapView"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:clickable="true"
/>
</LinearLayout>

四、最後就是軟體的主程序部分了、裡面需要的類和方法不多,主要以按鈕的監聽器和地圖的界面實現為主

Java代碼
public void onCreate(Bundle savedInstanceState) {
// this.setMapMode(MAP_MODE_VECTOR);//設置地圖為矢量模式

super.onCreate(savedInstanceState);
setContentView(R.layout.main);

mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setBuiltInZoomControls(true); // 設置啟用內置的縮放控制項
mMapController = mMapView.getController(); // 得到mMapView
// 的控制權,可以用它控制和驅動平移和縮放
point = new GeoPoint((int) (39.982378 * 1E6), (int) (116.304923 * 1E6)); // 用給定的經緯度構造一個GeoPoint,單位是微度(度*
// 1E6)
// 按鈕添加監聽器
button_location = (Button) findViewById(R.id.location);
longitude = (EditText) findViewById(R.id.longitude);
latite = (EditText) findViewById(R.id.latitude);
locationListener = new OnClickListener() {
public void onClick(View e) {
if (e.equals(button_location)) {
// 得到文本輸入框的中經緯 度坐標值
String latStr = longitude.getText().toString();
// 將得到的字元串轉成數值
double lat = Integer.parseInt(latStr);
String lngStr = latite.getText().toString();
double lng = Integer.parseInt(lngStr);
//轉成經緯度坐標
lat=lat*1E6;
lng=lng*1E6;
// 用給定的經緯度構造一個GeoPoint,單位是微度(度*1E6)
point = new GeoPoint((int) (lat), (int) (lng));
mMapController.setCenter(point); // 設置地圖中心點
mMapController.setZoom(12); // 設置地圖zoom 級別
// 添加地圖覆蓋物
// MyLocationOverlay(this, mMapView);
mylocTest.enableMyLocation(); // 判斷是否發現位置提供者
mylocTest.enableCompass(); // 打開指南針
mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物
}
}
};
// 按鈕添加監聽器
button_location.setOnClickListener(locationListener);
mMapController.setCenter(point); // 設置地圖中心點
mMapController.setZoom(12); // 設置地圖zoom 級別
// 添加地圖覆蓋物
mylocTest = new MyLocationOverlay(this, mMapView);
mylocTest.enableMyLocation(); // 判斷是否發現位置提供者
mylocTest.enableCompass(); // 打開指南針
mMapView.getOverlays().add(mylocTest);// 添加定位覆蓋物
}
//另外一個添加界面覆蓋物的類:

public class MyLocationOverlayProxy extends com.amap.mapapi.map.MyLocationOverlay{

private Location mLocation;
protected final Paint mPaint = new Paint();
protected final Paint mCirclePaint = new Paint();
private Bitmap gps_marker=null;
private Point mMapCoords = new Point();
private final float gps_marker_CENTER_X;
private final float gps_marker_CENTER_Y;
private final LinkedList<Runnable> mRunOnFirstFix = new LinkedList<Runnable>();
public MyLocationOverlayProxy(amap amap, MapView mMapView) {

super(amap, mMapView);
gps_marker = ((BitmapDrawable) amap.getResources().getDrawable(
R.drawable.marker_gpsvalid)).getBitmap();
gps_marker_CENTER_X = gps_marker.getWidth() / 2 - 0.5f;
gps_marker_CENTER_Y= gps_marker.getHeight() / 2 - 0.5f;
}

public boolean runOnFirstFix(final Runnable runnable) {
if (mLocation != null) {
new Thread(runnable).start();
return true;
} else {
mRunOnFirstFix.addLast(runnable);
return false;
}
}

public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
mLocation = location;
for(final Runnable runnable : mRunOnFirstFix) {
new Thread(runnable).start();
}
mRunOnFirstFix.clear();
super.onLocationChanged(location);
}

protected void drawMyLocation(Canvas canvas, MapView mapView, final Location mLocation,
GeoPoint point, long time) {
Projection pj=mapView.getProjection();
if (mLocation != null) {
mMapCoords=pj.toPixels(point, null);
final float radius = pj.metersToEquatorPixels(mLocation.getAccuracy());
this.mCirclePaint.setAntiAlias(true);
this.mCirclePaint.setARGB(35, 131, 182, 222);
this.mCirclePaint.setAlpha(50);
this.mCirclePaint.setStyle(Style.FILL);
canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);
this.mCirclePaint.setARGB(225, 131, 182, 222);
this.mCirclePaint.setAlpha(150);
this.mCirclePaint.setStyle(Style.STROKE);
canvas.drawCircle(mMapCoords.x, mMapCoords.y, radius, this.mCirclePaint);
canvas.drawBitmap(gps_marker, mMapCoords.x-gps_marker_CENTER_X, mMapCoords.y-gps_marker_CENTER_Y, this.mPaint);
}
}

}

❹ 跪求在線等,android 把圖片做成地圖 實現縮放移動功能,並且能根據GPS獲取的經緯度,在圖片上標注圖標,

通過比例換算,對應到圖片上。

❺ android系統 拍照片時 能不能記錄用戶的經緯度

大多數安卓手機拍攝照片是支持記錄地理位置信息的,若自帶相機沒有此功能,可以藉助第三方拍照軟體來實現此功能,如相機360。

❻ android得到經緯度怎麼獲取位置

Android地圖開發實際應用中,經常會通過地圖定位判斷手機用戶是哪個城市的,然後根據城市的不同調取不同的數據,或者是地圖定位之後,會在手機界面中顯示用戶的詳細位置,如石家莊市中山北國商城。
那麼這些信息如何獲得? 詳細研究過Android MapView的可能用到Geocoder這個對象。詳細代碼如下:[java] view plain
Geocoder geocoder=new Geocoder(this, Locale.getDefault());
try {
List<Address> addresses=geocoder.getFromLocation(latitude, longitude, 1);
StringBuilder stringBuilder=new StringBuilder();
if(addresses.size()>0){
Address address=addresses.get(0);
for(int i=0;i<address.getMaxAddressLineIndex();i++){
stringBuilder.append(address.getAddressLine(i)).append("\n");
}
stringBuilder.append(address.getLocality()).append("_");
stringBuilder.append(address.getPostalCode()).append("_");
stringBuilder.append(address.getCountryCode()).append("_");
stringBuilder.append(address.getCountryName()).append("_");
System.out.println(stringBuilder.toString());
}
} catch (IOException e) {
// TODO Auto-generated catch block
Toast.makeText(this, "報錯", Toast.LENGTH_LONG).show();
e.printStackTrace();
}

❼ android百度地圖怎麼查看指定地點的經緯度

  1. 先打開網路地圖首頁,本人身處在廣州,就以熟悉的廣州為例,查找廣州火車站的經緯度!

  2. 輸入廣州火車站,搜索一下廣州火車站的位置,這里就標記出廣州火車站以及進出口這類的,大致了解所要查詢地方的地理位置!

  3. 在地圖的左下角位置,找到地圖開放平台,並點擊進入!

  4. 進到地圖的開放平台後,將網頁向下拉,在插件與工具中, 可以看到「坐標拾取工具",點擊選用這個工具!

  5. 這時進入到網路地圖的拾取坐標系統的頁面,該頁面有詳細的功能說明與使用說明!

  6. 再次搜索我們需要查詢的地方名,定位後同樣會顯示我們需要查詢的地方!

  7. 將滑鼠移動到該地理位置上,就會顯示該地方的地址與坐標了!

  8. 同樣的,網路地圖也提供了經緯坐標的反查功能,即通過輸入坐標,就能查詢該地理位置,這時就需要勾選坐標反查!且輸入的經緯坐標用英文狀態下」,「隔開!

❽ 怎麼在android百度地圖通過經緯度來定位並且顯示出地圖位置

1、設置AndroidManfest.xml許可權ViewCode2、配置jar包3、初始化設置BMapManagerViewCodemapManager=newBMapManager(this);mapManager.init("",newMyMKGeneralListener());//設置通知間隔:iMaxSecond-最大通知間隔,單位:秒;iMinSecond-最小通知間隔,單位:秒mapManager.getLocationManager().setNotifyInternal(20,5);4、獲取手機經緯度,並顯示地址信息ViewCodemapManager.getLocationManager().requestLocationUpdates(newMyLocationListener());mapManager.start();在LocationListener中獲取經緯度{@(Locationarg0){intjin=(int)(arg0.getLatitude()*1000000);intwei=(int)(arg0.getLongitude()*1000000);tv1.setText("經度:"+jin+",緯度:"+wei);MKSearchsearch=newMKSearch();search.init(mapManager,newMyMKSearchListener());search.reverseGeocode(newGeoPoint(jin,wei));}}在MKSearch介面中進行地址轉化

❾ android中怎麼獲取經緯度

在Android應用程序中,可以使用LocationManager來獲取移動設備所在的地理位置信息。看如下實例:新建android應用程序TestLocation。
1、activity_main.xml布局文件

[html] view plain
print?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<TextView
android:id="@+id/positionView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

</LinearLayout>
用於顯示獲取到的位置信息。

2、MainActivity.Java

[java] view plain
print?

package com.example.testlocation;

import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

private TextView postionView;

private LocationManager locationManager;
private String locationProvider;

@Override
protected void onCreate(Bundle savedInstanceState) {

閱讀全文

與android圖片經緯度相關的資料

熱點內容
公路商店app標簽選什麼 瀏覽:337
linuxoracle命令行登錄 瀏覽:224
android深度休眠 瀏覽:169
php微信開發例子 瀏覽:843
醫得app登錄密碼是什麼 瀏覽:140
spring開發伺服器地址 瀏覽:411
伺服器上如何查看伺服器的埠 瀏覽:678
單片機伺服器編譯 瀏覽:770
單口usb列印機伺服器是什麼 瀏覽:859
戰地五開伺服器要什麼條件 瀏覽:956
在word中壓縮圖片大小 瀏覽:255
javatomcat圖片 瀏覽:419
程序員生產智能創意 瀏覽:67
匯和銀行app怎麼登錄 瀏覽:383
騰訊伺服器如何上傳源碼 瀏覽:748
單片機的原理概述 瀏覽:512
火控pdf 瀏覽:270
如何復制雲伺服器centos環境 瀏覽:988
債權pdf 瀏覽:307
紅色番字的app怎麼下載 瀏覽:877