double lat = location.getLatitude(); double lng = location.getLongitude(); point2ds = new Point2Ds(); point2ds.add(new Point2D(lng, lat)); Boolean isOk = CoordSysTranslator.forward(point2ds, prjCoordSys); m_mapControl.getMap().setCenter(point2ds.getItem(0)); m_mapControl.getMap().setScale(1/57373.046875); //将定位的点配置成指南针样式 mView = new CompassView(this); m_mapView.addView(mView); m_mapControl.getMap().refresh();
我是按照给之前给的Demo进行显示的,问题是底图的地图进行拖动以后,定位的点不随之变化,不知道调用什么方法让点和地图相关联起来
我将对应的代码改成了
Point2D point2d = new Point2D(lng, lat); GeoPoint geoPoint = new GeoPoint(point2d); point2ds = new Point2Ds(); point2ds.add(new Point2D(lng, lat)); m_mapControl.getMap().setCenter(point2ds.getItem(0)); m_mapControl.getMap().setScale(1 / 57373.046875); //设置样式 GeoStyle geoStyle_P = new GeoStyle(); geoStyle_P.setMarkerAngle(14.0); /*设置点状符号的大小,单位为毫米,精确到0.1毫米*/ geoStyle_P.setMarkerSize(new Size2D(3, 3)); //设置点的符号,每个点符号对应一个值 geoStyle_P.setMarkerSymbolID(0); geoStyle_P.setPointColor(new com.supermap.data.Color(R.color.colorAccent)); geoPoint.setStyle(geoStyle_P); m_mapControl.getMap().getTrackingLayer().add(geoPoint, "geoline"); m_mapControl.getMap().refresh();
输入的坐标是故宫,结果定位到了非洲的海湾,请教一下,这段哪里写错了吗?为什么会定位到非洲