无法在Android中读取形状文件

无法在Android中读取形状文件,android,maps,arcgis,Android,Maps,Arcgis,我正在尝试使用ShapefileFeatureTable()在android中读取形状文件。无论我给出什么路径,它都会显示“未找到文件”异常 try { ShapefileFeatureTable shpFileFeatTable = new ShapefileFeatureTable("/storage/sdcard/map.shp"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch(E

我正在尝试使用ShapefileFeatureTable()在android中读取形状文件。无论我给出什么路径,它都会显示“未找到文件”异常

try 
{
    ShapefileFeatureTable shpFileFeatTable = new ShapefileFeatureTable("/storage/sdcard/map.shp");
} 
catch (FileNotFoundException e) 
{
    e.printStackTrace();
} 
catch(Exception e)
{
    e.printStackTrace();
}
有人能帮我吗


注意:我正在使用Android Emulator。此外,我正在使用arcGIS库。

如果有帮助,请参阅此示例


如果有帮助,请参见此示例


您的应用程序可能未请求从外部存储读取的权限。您需要将以下内容放入AndroidManifest.xml中:

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

目前,a是只读的,但如果该类将来获得编辑功能,并且您希望进行编辑,则您的应用程序也需要请求写权限:

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

有关更多详细信息,请参阅


您的文件路径也可能(但不太可能)不正确。如果您请求读取权限,但仍然获得
FileNotFoundException
,请检查
新文件(“/path/to/File.shp”).exists()的值。如果Android看不到文件,ArcGIS也看不到文件。

您的应用程序可能没有请求从外部存储读取的权限。您需要将以下内容放入AndroidManifest.xml中:

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

目前,a是只读的,但如果该类将来获得编辑功能,并且您希望进行编辑,则您的应用程序也需要请求写权限:

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

有关更多详细信息,请参阅


您的文件路径也可能(但不太可能)不正确。如果您请求读取权限,但仍然获得
FileNotFoundException
,请检查
新文件(“/path/to/File.shp”).exists()的值。如果Android看不到该文件,ArcGIS也看不到该文件。

结果是,它正在显示shapefile。我必须清空地图视图才能看到它

<com.esri.android.map.MapView
    android:id="@+id/map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
</com.esri.android.map.MapView>

结果是,它正在显示shapefile。我必须清空地图视图才能看到它

<com.esri.android.map.MapView
    android:id="@+id/map"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
</com.esri.android.map.MapView>


我也有同样的问题。确保与map.shp相关的其他文件位于同一文件夹的map.shp旁边。与map.shp相关的其他文件的扩展名是:.dbf.prj.sbn.sbx.shp.xml.shx

我也有同样的问题。确保与map.shp相关的其他文件位于同一文件夹的map.shp旁边。与map.shp相关的其他文件的扩展名为:.dbf.prj.sbn.sbx.shp.xml.shx

尝试使用
环境获取路径。getExternalStorageDirectory()
尝试使用
环境获取路径。getExternalStorageDirectory()
您必须清空MapView吗?这是什么意思?加载shapefile时,如何修复FileNotFoundException?您必须清空MapView?这是什么意思?在加载shapefile时,这如何修复FileNotFoundException?