如何在android上的ArcGIS地图中添加标记?

如何在android上的ArcGIS地图中添加标记?,第1张

概述我正在尝试在 Android应用程序的ArcGIS地图上添加标记.但是,添加图形图层后,我的地图不会出现.我是Android应用程序编程的新手,非常感谢任何帮助.我不确定我在这里做错了什么.提前致谢. 这是我的代码: public class SuggestionsFragment extends Fragment { MapView mMapView; GraphicsLayer 我正在尝试在 Android应用程序的ArcGIS地图上添加标记.但是,添加图形图层后,我的地图不会出现.我是AndroID应用程序编程的新手,非常感谢任何帮助.我不确定我在这里做错了什么.提前致谢.

这是我的代码:

public class SuggestionsFragment extends Fragment {    MapVIEw mMapVIEw;    Graphicslayer graphicslayer = new Graphicslayer();    Point point;@OverrIDepublic VIEw onCreateVIEw(LayoutInflater inflater,VIEwGroup container,Bundle savedInstanceState) {    VIEw rootVIEw = inflater.inflate(R.layout.fragment_suggestions,container,false);    //RetrIEve the map and initial extent from XML layout    mMapVIEw = (MapVIEw)rootVIEw.findVIEwByID(R.ID.map);    //Create the layer    final Layer oneMapLayer = new   ArcGISTiledMapServiceLayer("http://e1.onemap.sg/arcgis/rest/services/BASEMAP/MapServer");    mMapVIEw.addLayer(graphicslayer);    Point point = new Point(1.3799775,103.84877200000005);    graphicslayer.addGraphic(new Graphic(point,new  SimpleMarkerSymbol(color.RED,10,STYLE.CIRCLE)));    //KNow when the map layer loaded    mMapVIEw.setonStatusChangedListener(new OnStatusChangedListener() {        private static final long serialVersionUID = 1L;        public voID onStatusChanged(Object source,STATUS status) {            if (source == oneMapLayer && status == STATUS.LAYER_LOADED) {                mMapVIEw.centerat(1.3799775,103.84877200000005,false);                mMapVIEw.setScale(1500,false);            }        }    });    //Add dynamic layer to MapVIEw    mMapVIEw.addLayer(oneMapLayer);    return rootVIEw;}@OverrIDepublic voID onDestroy() {    super.onDestroy();}@OverrIDepublic voID onPause() {    super.onPause();    mMapVIEw.pause();}@OverrIDepublic voID onResume() {    super.onResume();    mMapVIEw.unpause();}}
解决方法 解决方案:

public class SuggestionsFragment2 extends Fragment {MapVIEw mMapVIEw;Graphicslayer graphicslayer = new Graphicslayer();Point point;@OverrIDepublic VIEw onCreateVIEw(LayoutInflater inflater,Bundle savedInstanceState) {    VIEw rootVIEw = inflater.inflate(R.layout.fragment_suggestions2,false);    //RetrIEve the map and initial extent from XML layout    mMapVIEw = (MapVIEw)rootVIEw.findVIEwByID(R.ID.map);    //Create the layer    final Layer oneMapLayer = new ArcGISTiledMapServiceLayer("http://e1.onemap.sg/arcgis/rest/services/BASEMAP/MapServer");    //KNow when the map layer loaded    mMapVIEw.setonStatusChangedListener(new OnStatusChangedListener() {        private static final long serialVersionUID = 1L;        public voID onStatusChanged(Object source,false);                mMapVIEw.addLayer(graphicslayer);                Point point = GeometryEngine.project(x,y,mMapVIEw.getSpatialReference());                graphicslayer.addGraphic(new Graphic(point,new    SimpleMarkerSymbol(color.RED,STYLE.CIRCLE)));            }        }    });    //Add dynamic layer to MapVIEw    mMapVIEw.addLayer(oneMapLayer);    return rootVIEw;}@OverrIDepublic voID onDestroy() {    super.onDestroy();}@OverrIDepublic voID onPause() {    super.onPause();    mMapVIEw.pause();}@OverrIDepublic voID onResume() {    super.onResume();    mMapVIEw.unpause();}
总结

以上是内存溢出为你收集整理的如何在android上的ArcGIS地图中添加标记?全部内容,希望文章能够帮你解决如何在android上的ArcGIS地图中添加标记?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1125329.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存