准备和同学做一个Android的LBS小应用,但是感觉实在无从下手,资料也很少。我的想法是调用Google Map的api来使用GoogleMap的地图数据,用户可以自行添加一些东西,并且可以保存并在地图上显示出来。用户和其添加的数据使用SQL SERVER或ORACLE进行存储,但是不知道如何在使用时将其取出并应用,是否用到GIS Engine?哪个GIS比较好?还有个想法是使用Google Maps Data API。请问各位给个建议~还有请问LBS的应用应该如何开发?主要是用户添加的地理数据如何存储和应用?问题比较多,请大家见谅阿~
我也想过利用google map。不过最好能利用手机本身的服务。
大家有什么可以提供的意见吗?
import android.location.*;/**
* 定位处理工具类
* @author 陈跃峰
*/
public class LocationUtil {
/**
* 是否支持GPS,如果未打开则打开GPS
* @param context 上下文对象
* @return true代表支持,false代表未打开,则打开GPS设置界面
*/
public static boolean isSupport(Context context){
LocationManager locationManager ;
// 获取 LocationManager 服务
locationManager = (LocationManager) context
.getSystemService(Context. LOCATION_SERVICE );
boolean b = locationManager .isProviderEnabled(android.location.LocationManager. GPS_PROVIDER )
|| locationManager .isProviderEnabled(android.location.LocationManager. NETWORK_PROVIDER );
return b;
}
/**
* 获得经度和纬度
* @param context 上下文对象
* @return 经纬度数组,下标0是经度,下标1是纬度
*/
public static String[] getLongitudeAndLatitude(Context context){
LocationManager locationManager ;
String provider ;
Location location ;
String[] lbsStr = null;
// 获取 LocationManager 服务
locationManager = (LocationManager) context
.getSystemService(Context. LOCATION_SERVICE );
// 构建位置查询条件
Criteria criteria = new Criteria();
// 查询精度:高
criteria.setAccuracy(Criteria. ACCURACY_FINE );
// 是否查询海拨:否
criteria.setAltitudeRequired( false );
// 是否查询方位角 : 否
criteria.setBearingRequired( false );
// 是否允许付费:是
criteria.setCostAllowed( true );
// 电量要求:低
criteria.setPowerRequirement(Criteria. POWER_LOW );
// 返回最合适的符合条件的 provider ,第 2 个参数为 true 说明 , 如果只有一个 provider 是有效的 , 则返回当前 provider
provider = locationManager .getBestProvider(criteria, true );
// 获取位置
location = locationManager .getLastKnownLocation(provider);
if(location != null){
double lng = location.getLongitude();
double lat = location.getLatitude();
lbsStr = new String[2];
lbsStr[0] = "" + lng;
lbsStr[1] = "" + lat;
}
return lbsStr;
}}
我在这就谢谢各位了!!!!
emial:[email protected]