地图提供给我一个类似这样一个地址url:
http://192.168.120.41:8091/iserver/services/map-china400/rest/maps/China, 按照 SuperMap iMobile Lite for Android的代码实现:
URL:http://端口/mapapi_v03/map-mongodb-420000_SL_0518_SKY_20200620-3k6ybamafh/rest/maps/420000_SL_0518_SKY_20200620";
protected MapView mapView;
//创建地图窗口
mapView = (MapView) this.findViewById(R.id.mapview);
//创建地图图层,并指向iServer提供的地图服务
LayerView layerView = new LayerView(this);
layerView.setURL(DEFAULT_URL);
//設置相关的参数
Credential.CREDENTIAL=new Credential("key","UUaV8peu81aNSEYBFyKCnEuo");
CoordinateReferenceSystem crs=new CoordinateReferenceSystem();
crs.wkid=4490;
layerView.setCRS(crs);
//加载地图图层
mapView.addLayer(layerView);
//设置地图缩放
mapView.setBuiltInZoomControls(true);
mapView.getController().setZoom(14);
mapView.getController().setCenter(new Point2D(110.805406,32.634872));
mapView.refresh();
程序没有报错,地图控件处能显示缩放,但是地图控件显示白色。控制台消息是
2021-03-17 10:31:58.932 14239-14298/com.xzq.supermaptest D/com.supermap.android.maps.fstilecache: key(FSTILECACHE_ADDTILE_NOTFOUND) not found in resources.
java.io.FileNotFoundException: /storage/emulated/0/supermap/tiles/rest-map_1/420000_SL_0518_SKY_20200620/4490_18056_16384_8193_420000_SL_0518_SKY_20200620 (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:308)
at java.io.FileOutputStream.<init>(FileOutputStream.java:238)
at java.io.FileOutputStream.<init>(FileOutputStream.java:180)
at com.supermap.imobilelite.maps.FSTileCache.addTile(FSTileCache.java:82)
at com.supermap.imobilelite.maps.ThreadBasedTileDownloader$TileDownloadThread.addToDiskCache(ThreadBasedTileDownloader.java:787)
at com.supermap.imobilelite.maps.ThreadBasedTileDownloader$TileDownloadThread.processTile(ThreadBasedTileDownloader.java:802)
at com.supermap.imobilelite.maps.ThreadBasedTileDownloader$TileDownloadThread.run(ThreadBasedTileDownloader.java:824)
2021-03-17 10:32:00.999 14239-14301/com.xzq.supermaptest W/libEGL: EGLNativeWindowType 0x7df2d08010 disconnect failed
2021-03-17 10:32:02.656 14239-14239/com.xzq.supermaptest D/AwareBitmapCacher: handleInit switch not opened pid=14239