爱程序网

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);

 

关于爱程序网 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 人才招聘 - 帮助