Opening shapefiles using FeatureTable and FeatureLayer.

Discussion created by mb_roguski on Feb 4, 2014
Latest reply on Dec 19, 2014 by iMoVe

recently I was trying to open a shapefile on Android and display it on the map.
I am able to load the shapefile data but displaying it on the map is a little bit complicated.
I tried to use FeatureLayer and FeatureTable to do this, but unfortunately there was no visible map on the screen.
It it even possible to display shapefiles this way ?

Here is my code for FeatureLayer:
public class ShapefileLayer extends FeatureLayer {
    private String url;
    public ShapefileLayer(String shpPath, Envelope fullExtent) {
        super(new ShapefileFeatureTable(shpPath));
        url = new File(shpPath).getAbsolutePath();
    public double getMaxScale() {
        return 100000;
    public double getMinScale() {
        return 1;
    public String getUrl() {
        return url;

The other three classes are in next post because of the characters limit :)

In my MainActivity I add:
mapView.addLayer(new ShapefileLayer("/mnt/sdcard2/shp/gaz.shp", fullLayerExtent));

but I see only black screen or other layers if I add them too.
The file from sdCard is available and I am able to open it for reading and writing so no problems there.

These classes are very simple and do not include all the features I plan to add. It is made to only load geometry and display it on the map.