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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM