About the path problems that are encountered when loading offline shp files, geodatabase files

Source: Internet
Author: User

Before the beginning of the text or first spit groove, a line of code debug a day do not know how to change, finally stumbled out (the following SHP file for example)

For virtual machine testing

1          PublicString GetPath () {2File Sddir =NULL;3             BooleanSdcardexit =environment.getexternalstoragestate (). Equals (Android.os.Environment.MEDIA_MOUNTED);4             if(sdcardexit) {5Sddir =environment.getexternalstoragedirectory ();6             }7             returnsddir.tostring ();8}

The root directory of SD card is obtained by GetPath method, String tmp = GetPath () + "/sample/xxx.shp"; , this way to get SHP files is not a problem (shp files placed in the SD card under the sample folder), but I use the phone when the test is not available, the original through the GetPath method to obtain a cell phone directory for/storage/emulated/ 0, this is not the root directory I want, how to do? A word of mouth, this may be related to the phone, perhaps your phone with GetPath can get the correct SD card directory. What if we can't get it?

1. String Strmapurl = "FILE:///STORAGE/SDCARD1/SAMPLE/BEIJING01.TPK"; This can get the TPK file and load it correctly

2. String geopathstring= "/storage/sdcard1/sample/road3.shp"; This can get the SHP file and load it correctly

3. String pathstring=new File (Environment.getexternalstoragedirectory (). GetParent ()). GetParent () + "/sdcard1/sample /road2.shp "; This can get the SHP file and load it correctly

The above three methods need to be based on the specific circumstances of the phone to try, I have so far not know what is the reason, the following is my phone directory structure

Well, it is superficial superficial phenomenon, the intrinsic substance I have not understood, welcome the great god to answer

About the path problems that are encountered when loading offline shp files, geodatabase files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.