andriod arcgis加载影像TIF
private static final String TAG = "MainActivity";
private MapView mapView = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.mapView = (MapView)this.findViewById(R.id.map);
String rasterPath = Environment.getExternalStorageDirectory().getPath() +"/ArcGIS/samples/Raster/QL_IMage.tif"; //QL_IMage.tif,Landsat8Hawaii_naturecolor.tif
FileRasterSource rasterSource =null;
try {
rasterSource = new FileRasterSource(rasterPath);
} catch (IllegalArgumentException ie) {
Log.d(TAG, "null or empty path");
} catch (FileNotFoundException fe) {
Log.d(TAG, "raster file doesn't exist");
} catch (RuntimeException re) {
Log.d(TAG, "raster file can't be opened");
}
RasterLayer rasterLayer = new RasterLayer(rasterSource);
this.mapView.addLayer(rasterLayer);
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步