Select to view content in your preferred language

Error loading ENC layer: Invalid argument.

79
1
Monday
MaríaBencomo
Occasional Contributor

Hi,

I'm facing this problem.. i have my ENC charts in this path /storage/emulated/0/Android/data/com.example.enc_pt/cache/charts/VE300600/ENC_ROOT. When i'm trying to loading it, i got this error:  Error loading ENC layer: Invalid argument.

In the image you can see i got bot files .000 and .031.

This how i load it:

Any help would be appreciate.

Maria.

private void loadEncExchangeSet(List<String> folders) {
Log.d("EncLoader", "Loading folders into ENC Exchange Set...");
/*for (String folder : folders) {
Log.d("EncLoader", "→ " + folder);
}*/

String pa = "/storage/emulated/0/Android/data/com.example.enc_pt/cache/charts/VE300600/ENC_ROOT/CATALOG.031";

List<String> p = Collections.singletonList(pa);

//mEncExchangeSet = new EncExchangeSet(folders);
mEncExchangeSet = new EncExchangeSet(p);
mEncExchangeSet.loadAsync();

mEncExchangeSet.addDoneLoadingListener(() -> {
if (mEncExchangeSet.getLoadStatus() == LoadStatus.LOADED) {
// add each data set's Enc cell as an ENC layer
for (EncDataset encDataset : mEncExchangeSet.getDatasets()) {
// create an ENC layer with an ENC cell using the dataset
EncLayer encLayer = new EncLayer(new EncCell(encDataset));
// add the ENC layer to the map's operational layers
mMapView.getMap().getOperationalLayers().add(encLayer);
encLayer.addDoneLoadingListener(() -> {
if (encLayer.getLoadStatus() == LoadStatus.LOADED) {
Envelope extent = encLayer.getFullExtent();
// combine extents of each layer
if (mCompleteExtent == null) {
mCompleteExtent = extent;
} else {
mCompleteExtent = GeometryEngine.combineExtents(Arrays.asList(mCompleteExtent, extent));
}
// set the view point to the extent of all enc layers
mMapView.setViewpointAsync(new Viewpoint(mCompleteExtent));
} else {
Log.d("EncLoader", "Error loading ENC layer: " + encLayer.getLoadError().getMessage());

}
});
}
} else {
String error = "Error loading ENC exchange set: " + mEncExchangeSet.getLoadError().getMessage();
Toast.makeText(this, error, Toast.LENGTH_LONG).show();
Log.e(TAG, error);
}
});
}enc.png
0 Kudos
1 Reply
CodyPatterson
MVP Regular Contributor

Hey @MaríaBencomo 

Would it be because you're referencing the file directly? You may need to put this:

String pa = "/storage/emulated/0/Android/data/com.example.enc_pt/cache/charts/VE300600/ENC_ROOT";

To my knowledge it would be directory access rather than direct file access, but I would also make sure that you have correct permissions to access the folder.

Cody

0 Kudos