AnsweredAssumed Answered

About displaying Electronic Navigational Charts

Question asked by slm1234 on Jul 18, 2018
Latest reply on Aug 17, 2018 by RChintapalli-esristaff

Hello, we are trying to create an app that show our local *.000 sea map file with Android Studio. We wrote some codes like the tutorial  here for displaying ENC. But they aren't working. Could you help us? Where exactly did we wrong or could you send us a code?

 

So here our codes in MainActivity:

 

package com.example.slm.mapvw;

import android.os.Environment;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.esri.arcgisruntime.hydrography.EncCell;
import com.esri.arcgisruntime.hydrography.EncDataset;
import com.esri.arcgisruntime.hydrography.EncEnvironmentSettings;
import com.esri.arcgisruntime.hydrography.EncExchangeSet;
import com.esri.arcgisruntime.layers.EncLayer;
import com.esri.arcgisruntime.mapping.view.MapView;
import com.esri.arcgisruntime.mapping.ArcGISMap;

import java.util.ArrayList;
import java.util.Arrays;

public class MainActivity extends AppCompatActivity {

    public MapView mMapView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mMapView = findViewById(R.id.mapView);

        ArcGISMap map = new ArcGISMap();


        EncEnvironmentSettings.setResourcePath("file:///android_asset/hydrography/");
        EncEnvironmentSettings.setSencDataPath("file:///android_asset/sencDataPath/");

        EncExchangeSet encExchangeSet =
                new EncExchangeSet(new ArrayList<>(Arrays.asList("file:///android_asset/ENC_ROOT/CATALOG.031")));
        encExchangeSet.loadAsync();

        encExchangeSet.addDoneLoadingListener(() -> {
            for (EncDataset encDataset : encExchangeSet.getDatasets()) {
                EncLayer encLayer = new EncLayer(new EncCell(encDataset));
                map.getOperationalLayers().add(encLayer);
            }
        });

        mMapView.setMap(map);

        EncEnvironmentSettings.getDisplaySettings().getTextGroupVisibilitySettings().setIsNatureOfSeabed(true);
    }
    @Override
    protected void onPause(){
        mMapView.pause();
        super.onPause();
    }

    @Override
    protected void onResume(){
        super.onResume();
        mMapView.resume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mMapView.dispose();
    }

}

 

 

 

I'm using those permisions in AndroidManifest.xml

 

 

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

 

 

And also our build.gradle's and resource folders:

 

 

 

 

Thank you in advance!

Outcomes