google map 地址 標記
發表人:
訪客
如果限制的是gps 附近的範圍呢???
因為gps 周圍總不能限死的變數吧=.=??....怎樣跟隨gps的變動,範圍也跟隨著變動 ??
就好像固定 某地的一公里範圍這樣,,,
因為gps 周圍總不能限死的變數吧=.=??....怎樣跟隨gps的變動,範圍也跟隨著變動 ??
就好像固定 某地的一公里範圍這樣,,,
發表人:
Seachaos
積分: 2432
積分: 2432
是的,距離的部份就是要自已計算
(以某中心點 加上一定的範圍)
這邊有個把GPS座標轉公尺的範例
[sea:javaCode]
Location
A = new Location("reverseGeocoded"),
B = new Location("reverseGeocoded");
A.setLatitude(24.974800);
A.setLongitude(121.447600);
B.setLatitude(24.974855);
B.setLongitude(121.447678);
int distance = (int)A.distanceTo(B);
[/sea]
輸入A地和B地的GPS座標,distance就是兩地的距離 (單位是公尺)
(以某中心點 加上一定的範圍)
這邊有個把GPS座標轉公尺的範例
[sea:javaCode]
Location
A = new Location("reverseGeocoded"),
B = new Location("reverseGeocoded");
A.setLatitude(24.974800);
A.setLongitude(121.447600);
B.setLatitude(24.974855);
B.setLongitude(121.447678);
int distance = (int)A.distanceTo(B);
[/sea]
輸入A地和B地的GPS座標,distance就是兩地的距離 (單位是公尺)
發表人:
訪客
你好!
想請問一下這篇文章是否有連結php+mysql?
是否可以抓資料庫內的經緯度並標記載android地圖上?
想請問一下這篇文章是否有連結php+mysql?
是否可以抓資料庫內的經緯度並標記載android地圖上?
發表人:
Seachaos
積分: 2432
積分: 2432
你好:
上面說的只是標記在Google Map上的方法
可以抓PHP和MySQL的資料顯示在Google Map上
但要自已去實做連接的方式
上面說的只是標記在Google Map上的方法
可以抓PHP和MySQL的資料顯示在Google Map上
但要自已去實做連接的方式
發表人:
訪客
我現在可以在MAP上標出地標,但是經緯度都寫在程式碼內
現在的問題就是
如何將MYSQL內的地標標記到Android Map上
我之前有試過將php+mysql連到android並顯示在textview,
但要把map和php結合並標記該怎麼做?
版大可以給點建議嗎?
現在的問題就是
如何將MYSQL內的地標標記到Android Map上
我之前有試過將php+mysql連到android並顯示在textview,
但要把map和php結合並標記該怎麼做?
版大可以給點建議嗎?
發表人:
Seachaos
積分: 2432
積分: 2432
[quote]訪客 提到:
我現在可以在MAP上標出地標,但是經緯度都寫在程式碼內
現在的問題就是
如何將MYSQL內的地標標記到A...[/quote]
其實這原理就和你顯示在TextView差不多
有點類似參數的方式,可以把資料放在Array內
然後再轉到MapView上
我現在可以在MAP上標出地標,但是經緯度都寫在程式碼內
現在的問題就是
如何將MYSQL內的地標標記到A...[/quote]
其實這原理就和你顯示在TextView差不多
有點類似參數的方式,可以把資料放在Array內
然後再轉到MapView上
發表人:
訪客
那我可以把資料存成xml檔放在手機內
再用bufferedreader去讀取並標記嗎?
再用bufferedreader去讀取並標記嗎?
發表人:
訪客
請問有沒有把資料放在Array內的範例可以參考?
想了很久還是不通該怎麼把資料放在Array內...
想了很久還是不通該怎麼把資料放在Array內...
發表人:
Seachaos
積分: 2432
積分: 2432
1.可以用XML的方式沒有問題,Android有支援XML的Parser
2.可以參考看看JAVA的LinkedList或是ArrayList之類的用法
2.可以參考看看JAVA的LinkedList或是ArrayList之類的用法
發表人:
訪客
那請問一下 php該怎麼做才能把經緯度 傳送給android上?
發表人:
Seachaos
積分: 2432
積分: 2432
Android要和PHP交換資料的話可以參考看看這篇文章
如果有問題的話歡迎一起討論 :)
如果有問題的話歡迎一起討論 :)
發表人:
訪客
傳送到Android 都是亂碼
這是什麼問題呢?
這是什麼問題呢?
發表人:
Seachaos
積分: 2432
積分: 2432
你是傳中文嗎?
中文的話要用UTF-8編碼
英文在正常情況下應該是不會有亂碼的
中文的話要用UTF-8編碼
英文在正常情況下應該是不會有亂碼的
發表人:
訪客
謝謝已經解決亂碼問題 ^_^
發表人:
訪客
有人可以幫忙詳解這程式碼嗎..最近也在想如何將php的經緯轉成地標在map上
請求支援!
public class MapUtility {
public static JSONObject getLocationInfo(String address) {
HttpGet httpGet = new HttpGet("http://maps.google."
+ "com/maps/api/geocode/json?address=" + address
+ "&sensor=false");
HttpClient client = new DefaultHttpClient();
HttpResponse response;
StringBuilder stringBuilder = new StringBuilder();
try {
response = client.execute(httpGet);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
int b;
while ((b = stream.read()) != -1) {
stringBuilder.append((char) b);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject = new JSONObject(stringBuilder.toString());
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject;
}
// converts JSONObject into a GeoPoint.
public static GeoPoint getGeoPoint(JSONObject jsonObject) {
Double lon = new Double(0);
Double lat = new Double(0);
try {
lon = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lng");
lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
} catch (JSONException e) {
e.printStackTrace();
}
return new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
}
}
請求支援!
public class MapUtility {
public static JSONObject getLocationInfo(String address) {
HttpGet httpGet = new HttpGet("http://maps.google."
+ "com/maps/api/geocode/json?address=" + address
+ "&sensor=false");
HttpClient client = new DefaultHttpClient();
HttpResponse response;
StringBuilder stringBuilder = new StringBuilder();
try {
response = client.execute(httpGet);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
int b;
while ((b = stream.read()) != -1) {
stringBuilder.append((char) b);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject = new JSONObject(stringBuilder.toString());
} catch (JSONException e) {
e.printStackTrace();
}
return jsonObject;
}
// converts JSONObject into a GeoPoint.
public static GeoPoint getGeoPoint(JSONObject jsonObject) {
Double lon = new Double(0);
Double lat = new Double(0);
try {
lon = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lng");
lat = ((JSONArray) jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
} catch (JSONException e) {
e.printStackTrace();
}
return new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
}
}
發表人:
訪客
也是卡在
怎麼讓mysql 的資料乖乖在arraylist
然後變成標記出現在地圖上...ˊˋ
各位版大可以救救我們嗎 T^T
怎麼讓mysql 的資料乖乖在arraylist
然後變成標記出現在地圖上...ˊˋ
各位版大可以救救我們嗎 T^T