I am trying to load a shapefile (not displaying at the moment) using the following:

Hardware: Android rugged tablet running Android 4.2

SDK: ArcGis 10.2.6-2

Shapefile: http://rdw.sandag.org/file_store%5CDistrict/Tax_Rate_Area.zip

My Layout:

        mapoptions.center="32.713408, -117.162454"

My Code:

private void test4() {
    String myExternalStorageLocation = null;
    String myFileLocationPath = null;
    try {
        // in onCreate -> mMapView = (MapView) findViewById(R.id.map);
        // in onCreate -> test4();

        // Ad .shp features layer
        myExternalStorageLocation = System.getenv("SECONDARY_STORAGE");
        myFileLocationPath = "/Maps/SanDiego/Tax_Rate_Area/Tax_Rate_Area.shp";
        mShapefileFeatureTable = new ShapefileFeatureTable(myExternalStorageLocation + myFileLocationPath);
        mFeatureLayer = new FeatureLayer(mShapefileFeatureTable);

        SimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol(Color.MAGENTA);
        SimpleRenderer simpleRenderer = new SimpleRenderer(simpleFillSymbol);





    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        Toast.makeText(MainActivity.this, "File not found @: "
                + myExternalStorageLocation + myFileLocationPath, Toast.LENGTH_SHORT).show();

First, I was unable to download the zip to inspect the shapefile. Second, the var:

mapoptions.center="32.713408, -117.162454"

I'm not sure about this specific SDK but traditionally such vars are in the form X,Y. Unless you're near the south pole and somewhere 32 degrees east of GMT, I would guess you want to reverse your center coordinates. Your code indicates San Diego and switching the coordinates puts you just off the coast of SD.

It's a common issue, since almost everyone - myself included - refers to "lat/long", which is in fact Y,X (or the equivalent, since it's not truly Cartesian). X refers to longitude or easting; Y is latitude or northing.

I hope this helps. Sorry if that's not the solution.


  • Thanks for the answer, it seems that the shape file is visible if I use a blank map:code <com.esri.android.map.MapView android:id="@+id/map" android:layout_width="fill_parent" android:layout_height="fill_parent"> </com.esri.android.map.MapView> code
    – Zander
    Jul 7 '15 at 20:41

FeatureLayers correspond to one FeatureTable, in your case ShapefileFeatureTable, which you correctly passed to the FeatureLayer constructor. In order for your Shapefile to be correctly displayed the getSpatialReference() value must match the spatial reference of the map to which the FeatureLayer is added. The Streets basemap you add in your layout is in Web Mercator (WKID 102100). Based on the fact that you can see the shapefile when you remove the Streets basemap confirms they are not in the same spatial reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.