arcgis android 图上记录gps轨迹
public class MainActivity extends Activity {
MapView mMapView;
LocationDisplayManager lDisplayManager = null;
GraphicsLayer gpsGraphicsLayer;
Polyline mPolyline;
int pointCount = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// after the content of this activity is set
// the map can be accessed from the layout
mMapView = (MapView) findViewById(R.id.map);
ArcGISTiledMapServiceLayer tile = new ArcGISTiledMapServiceLayer("http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity_Mobile/MapServer");
mMapView.addLayer(tile);
gpsGraphicsLayer = new GraphicsLayer();
mMapView.addLayer(gpsGraphicsLayer);
mPolyline = new Polyline();
mMapView.setOnStatusChangedListener(new OnStatusChangedListener() {
@Override
public void onStatusChanged(Object source, STATUS status) {
if (source == mMapView && status == STATUS.INITIALIZED) {
lDisplayManager = mMapView.getLocationDisplayManager();//获取LocationDisplayManager
lDisplayManager.setAutoPanMode(LocationDisplayManager.AutoPanMode.OFF);
lDisplayManager.setShowLocation(false);//不显示当前位置,坐标系不一致坐标偏移严重
lDisplayManager.setShowPings(false);
lDisplayManager.setAccuracyCircleOn(false);
lDisplayManager.setAllowNetworkLocation(true);
lDisplayManager.setLocationListener(new LocationListener() {
@Override
public void onLocationChanged(Location loc) {
//火星坐标转换
double[] gcj = CoordinateConvert.wgs2GCJ(loc.getLatitude(), loc.getLongitude());
Point wgspoint = new Point(gcj[1], gcj[0]);
Point p = (Point) GeometryEngine.project(wgspoint,
SpatialReference.create(SpatialReference.WKID_WGS84),
mMapView.getSpatialReference());
SimpleMarkerSymbol ptSym = new SimpleMarkerSymbol(Color.BLUE, 15,
SimpleMarkerSymbol.STYLE.CIRCLE);
Graphic graphic = new Graphic(p, ptSym, null);
if (pointCount == 0) {
mPolyline.startPath(p.getX(), p.getY());
mMapView.zoomTo(p, 17);
} else {
mPolyline.lineTo(p.getX(), p.getY());//点画线
mMapView.centerAt(p, true);
}
gpsGraphicsLayer.removeAll();
SimpleLineSymbol lineSym = new SimpleLineSymbol(Color.RED, 10);
Graphic g = new Graphic(mPolyline, lineSym);
gpsGraphicsLayer.addGraphic(g);
pointCount++;
gpsGraphicsLayer.addGraphic(graphic);
}
@Override
public void onProviderDisabled(String arg0) {
}
@Override
public void onProviderEnabled(String arg0) {
}
@Override
public void onStatusChanged(String arg0, int arg1,
Bundle arg2) {
}
}); // Actionlistener
lDisplayManager.start();
}
}
});
}
}
arcgis android 图上记录gps轨迹的更多相关文章
- ArcGIS for Android地图上实际距离与对应的屏幕像素值计算
本篇文章主要介绍了"ArcGIS for Android地图上实际距离与对应的屏幕像素值计算",主要涉及到ArcGIS for Android地图上实际距离与对应的屏幕像素值计算方 ...
- GPS/轨迹追踪、轨迹回放、围栏控制
折腾一个多月终于弄完了这个项目,起初都未曾接触GPS/轨迹追踪.轨迹回放.圈划围栏...等一些在百度地图或者Googel地图操作的一些业务,后端的业务相对来说简单点 cas单点登录,mongdb灵活的 ...
- 强烈推荐:Android史上最强大的自定义任务软件Tasker
强烈推荐:Android史上最强大的自定义任务软件Taskerhttp://bbs.mumayi.com/thread-28387-1-1.html(出处: 木蚂蚁手机乐园) Android上的Tas ...
- Android权限全记录(转)
常用权限: 读写存储卡装载和卸载文件系统 android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_EXTERNAL_STOR ...
- (转) Android平台上关于IM的实践总结
前言 IM通信在互联网发展到现在已经是码农的世界里人尽皆知的技术,特别在当下移动互联网迅猛发展的时代这种技术的开发也更加火热,其中老牌的代表作就有QQ和MSN,和最近新崛起的微信,默默,易信,来往等眼 ...
- Arcgis android - Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE
报错: Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE Please check logcat output for more deta ...
- 如何在 Android 手机上实现抓包?
如何在 Android 手机上实现抓包? http://www.zhihu.com/question/20467503 我想知道某个应用究竟在数据提交到哪里,提交了什么.网上的教程太复杂,不想麻烦.有 ...
- 如何增强ArcGIS插值图出图效果
如何增强ArcGIS插值图出图效果 by 李远祥 在一些科研领域,经常会遇到使用插值的方式进行处理,并生成最终的插值图.插值图在ArcGIS里面非常容易生成,只要具备了采用点数据,通过ArcToolB ...
- arcgis android 中shapefile的加载
前言 本文为大家分享arcgis android 中shapefile的加载,默认你有java环境,懂一定的android基础知识,默认你已经安装android studio.如缺乏以上环境和知识,请 ...
随机推荐
- 树(二)——二叉树
目录 本章主要讲解内容为: 树的非递归遍历算法,两种版本 树的扩展前缀以及前缀中缀构建方法 源码 btree.cpp btree.h 基础知识 一.定义 二叉树的递归定义:二叉树是每个结点最多含有两棵 ...
- Android文字跑马灯控件(文本自动滚动控件)
最近在开发一个应用,需要用到文本的跑马灯效果,图省事,在网上找,但老半天都找不到,后来自己写了一个,很简单,代码如下: import android.content.Context; import a ...
- hadoop运行原理之Job运行(三) TaskTracker的启动及初始化
与JobTracker一样,TaskTracker也有main()方法,然后以线程的方式启动(继承了Runnable接口).main()方法中主要包含两步:一是创建一个TaskTracker对象:二是 ...
- iOS流量监控
http://code4app.com/snippets/one/iOS%E6%B5%81%E9%87%8F%E7%9B%91%E6%8E%A7/5020ba7a6803fae325000000 1. ...
- valueOf() toString() typeof instanceof
******在chrome console中运行{a:1}.valueOf(); 报错:"SyntaxError: Unexpected token . ",这是由于{}被js引擎 ...
- C语言基础--数组及相关
概念: 一堆相同类型的数据的有序集合 格式: 元素类型 数组名称[ 元素个数 ] 定义数组: // 定义了一个名称叫做scores的数组, 数组中可以存放3个int类型的数据 ]; // 只要定义一 ...
- 64位 ubuntu android studio gradle 权限不够 缺少文件和权限导致
安装 32位 库文件 sudo apt-get install lib32z1 给文件夹加权限 chmod 777 -R SDK chmod 777 -R android-studio -R表示所有 ...
- Jenkins 2.26 发布,可扩展的持续集成引擎
Jenkins 2.26 发布了.Jenkins 主要用于持续.自动地构建/测试软件项目,如CruiseControl与DamageControl,监控一些定时执行的任务.更新内容: Allow Co ...
- Dooioo Deal
using AnfleCrawler.Common; using System; using System.Collections.Generic; using System.Linq; using ...
- linux后台运行和关闭、查看后台任务(转)
转自:http://www.cnblogs.com/kaituorensheng/p/3980334.html fg.bg.jobs.&.nohup.ctrl+z.ctrl+c 命令 一.&a ...