Help needed: Load SHP from File with Xamarin.Essentials FilePicker => File not found: Invalid path or missing shapefile data.

11-16-2021 08:32 AM
New Contributor

Hi and good evening,

my Xamarin.Forms App (tested on Android 10) must work offline, flexible and with vector data. My idea was to store the data in shape files or geojson on the external storage on the mobile device.  The selection should be done with filepicker from xamarin.essentials.

var da_file = await FilePicker.PickAsync();
String file_path = da_file.FullPath;

Result: /storage/emulated/0/Android/data/com.companyname.gasdetect/cache/2203693cc04e0be7f4f024d5f9499e13/04aee9d2077447eb922c8d44e3f1902d/gemeinden.shp

or Result: /storage/emulated/0/Android/data/com.companyname.gasdetect/cache/2203693cc04e0be7f4f024d5f9499e13/66029f1ad161475b8474bc606a7003c8/railway.geojson


ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(file_path);

I get the result: File not found: Invalid path or missing shapefile data.

The files are there, the geojson file is loaded. I tested with several sets of shp files.

What is going here? or Do you have a better idea to solve the offline data challenge?

Thank you in advance.

Cheers Franz

0 Kudos
2 Replies
Esri Notable Contributor

Did you give the application permission to read that location?

0 Kudos
New Contributor

Hi Morten,

yes I did. I can read GEOJSON from same folder. Is it license problem?

cheers Georg

0 Kudos