地圖定位標(biāo)注中心點,地圖中心點定位

領(lǐng)事地圖標(biāo)注 2022-06-22 17:30
【摘要】小編為您整理如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注、如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注、如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注、有誰知道iOS開發(fā)怎么能將根據(jù)地圖搜索API搜索出來的地名直接標(biāo)注在地圖中心點上嗎、地圖可以設(shè)置鳳凰為中心點嗎相關(guān)地圖標(biāo)記知識,詳情可查看下方正文!

如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注?

女孩,無論經(jīng)歷過什么,都要努力讓自己像杯白開水一樣,沉淀、清澈。白開水并不是索然無味的,它是你想要變化的,所有味道的根本。絢爛也好,低靡也罷,總是要回歸平淡,做一杯清澈的白開水,溫柔的剛剛好。


如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注?

如果你想使的第一列(即A列)在拖動其他列時保持不動,就先將光標(biāo)點擊到B列第一行的格子里(即坐標(biāo)B1),然后再屏幕上方工具欄中點擊“窗口”,選擇點擊“窗口凍結(jié)”就可以了。 如果想有兩列(A,B列)不動,就選擇“坐標(biāo)C1”欄。


如何在鼠標(biāo)拖動后地圖的中心點添加標(biāo)注?

如果你想使的第一列(即A列)在拖動其他列時保持不動,就先將光標(biāo)點擊到B列第一行的格子里(即坐標(biāo)B1),然后再屏幕上方工具欄中點擊“窗口”,選擇點擊“窗口凍結(jié)”就可以了。 如果想有兩列(A,B列)不動,就選擇“坐標(biāo)C1”欄。


有誰知道iOS開發(fā)怎么能將根據(jù)地圖搜索API搜索出來的地名直接標(biāo)注在地圖中心點上嗎?

首先創(chuàng)建工程,并在工程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 了。
二、我們在不熟悉的情況下、先盡量多的添加此軟件應(yīng)用權(quán)限;所以在mainifest中添加如下代碼;插入的位置在 <application的代碼之前。 Java代碼 <uses-permission :name=".permission.ACCESS_COARSE_LOCATION"></uses-permission> <uses-permission :name=".permission.ACCESS_FINE_LOCATION"></uses-permission> <uses-permission :name=".permission.INTERNET"></uses-permission> <uses-permission :name=".permission.ACCESS_NETWORK_STATE"></uses-permission> <uses-permission :name=".permission.WRITE_EXTERNAL_STORAGE"></uses-permission> <uses-permission :name=".permission.READ_PHONE_STATE"></uses-permission> <uses-permission :name=".permission.CHANGE_WIFI_STATE"></uses-permission> <uses-permission :name=".permission.ACCESS_WIFI_STATE"></uses-permission>
三、接著就要在res文件下的layout中添加界面布局了。其代碼如下、你可以完全復(fù)制進去。 Java代碼 <?xml version="
1.0" encoding="utf-8"?> <LinearLayout xmlns:="http://schemas./apk/res/" :orientation="vertical" :layout_width="fill_parent" :layout_height="fill_parent" > <!--添加文本輸入框,查找地址--> <LinearLayout :layout_height="wrap_content" :layout_width="wrap_content" :orientation="horizontal" xmlns:="http://schemas./apk/res/" :layout_gravity="center_horizontal"> <TextView :layout_height="wrap_content" :layout_width="wrap_content" :text="經(jīng)度"/> <EditText :layout_height="fill_parent" :layout_width="100px" :id="@+id/longitude"/> <TextView :layout_height="wrap_content" :layout_width="wrap_content" :text="緯度"/> <EditText :layout_height="fill_parent" :layout_width="100px" :id="@+id/latitude"/> <Button :layout_width="wrap_content" :layout_height="wrap_content" :text="查找" :id="@+id/button"/> </LinearLayout> <com.amap.map.map.MapView :id="@+id/mapView" :layout_width="fill_parent" :layout_height="fill_parent" :clickable="true" /> </LinearLayout>
四、最后就是軟件的主程序部分了、里面需要的類和方法不多,主要以按鈕的監(jiān)聽器和地圖的界面實現(xiàn)為主 Java代碼 public void onCreate(Bundle savedInstanceState) { // this.setMapMode(MAP_MODE_VECTOR);//設(shè)置地圖為矢量模式 super.onCreate(savedInstanceState); setContentView(R.layout.main); mMapView = (MapView) findViewById(R.id.mapView); mMapView.setBuiltInZoomControls(true); // 設(shè)置啟用內(nèi)置的縮放控件 mMapController = mMapView.getController(); // 得到mMapView // 的控制權(quán),可以用它控制和驅(qū)動平移和縮放 nt = new GeoPoint((int) (3
9.982378 * 1E6), (int) (11
6.304923 * 1E6)); // 用給定的經(jīng)緯度構(gòu)造一個GeoPoint,單位是微度(度* // 1E6) // 按鈕添加監(jiān)聽器 button_location = (Button) findViewById(R.id.location); longitude = (EditText) findViewById(R.id.longitude); latidute = (EditText) findViewById(R.id.latitude); locationListener = new OnClickListener() { public void onClick(View e) { if (e.equals(button_location)) { // 得到文本輸入框的中經(jīng)緯 度坐標(biāo)值 String latStr = longitude.getText().toString(); // 將得到的字符串轉(zhuǎn)成數(shù)值 double lat = Integer.parseInt(latStr); String lngStr = latidute.getText().toString(); double lng = Integer.parseInt(lngStr); //轉(zhuǎn)成經(jīng)緯度坐標(biāo) lat=lat*1E6; lng=lng*1E6; // 用給定的經(jīng)緯度構(gòu)造一個GeoPoint,單位是微度(度*1E6) nt = new GeoPoint((int) (lat), (int) (lng)); mMapController.setCenter(nt); // 設(shè)置地圖中心點 mMapController.setZoom(12); // 設(shè)置地圖zoom 級別 // 添加地圖覆蓋物 // MyLocationOverlay(this, mMapView); mylocTest.enableMyLocation(); // 判斷是否發(fā)現(xiàn)位置提供者 mylocTest.enableCompass(); // 打開指南針 mMapView.getOverlays().add(mylocTest);// 添加標(biāo)注覆蓋物 } } }; // 按鈕添加監(jiān)聽器 button_location.setOnClickListener(locationListener); mMapController.setCenter(nt); // 設(shè)置地圖中心點 mMapController.setZoom(12); // 設(shè)置地圖zoom 級別 // 添加地圖覆蓋物 mylocTest = new MyLocationOverlay(this, mMapView); mylocTest.enableMyLocation(); // 判斷是否發(fā)現(xiàn)位置提供者 mylocTest.enableCompass(); // 打開指南針 mMapView.getOverlays().add(mylocTest);// 添加標(biāo)注覆蓋物 } //另外一個添加界面覆蓋物的類: public class MyLocationOverlayProxy extends com.amap.map.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 nt, long time) { Projection pj=mapView.getProjection(); if (mLocation != null) { mMapCoords=pj.toPixels(nt, 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); } } }


地圖可以設(shè)置鳳凰為中心點嗎?

可以,標(biāo)注到鳳凰就行

可以的,把地點設(shè)到鳳凰就好了哈

可以,標(biāo)注到鳳凰就行


上一篇 :如何使用地圖添加指路人地圖標(biāo)注服務(wù)中心鋪?如何使用地圖添加自己指路人地圖標(biāo)注服務(wù)中心鋪?

下一篇:怎么在地圖標(biāo)記自己家指路人地圖標(biāo)注服務(wù)中心?怎么在地圖上標(biāo)記自己家指路人地圖標(biāo)注服務(wù)中心?