I am trying to add london shapefile for buildings in my android app. However, I am unable to display it. Its showing nothing on the map. But the same shapefile is getting displayed properly online. So, there is nothing wrong with the shapefile.
I downloaded shapefile fromhttps://docs.google.com/uc?id=0B0kRhiw4fD7uQzU3MzBMRzFfSFk&export=download
My code:layout.xml
MapActivity.java
mMapView = (MapView) findViewById(R.id.map); mMapView.enableWrapAround(true); String mShapefilePath = "/london_buildings/TQTL_LON.shp"; String mSdcard = Environment.getExternalStorageDirectory().getPath(); mMapView = (MapView) findViewById(R.id.map); ArcGISTiledMapServiceLayer mTiledlayer = new ArcGISTiledMapServiceLayer( "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"); mMapView.addLayer(mTiledlayer); try { shpFileFeatTable = new ShapefileFeatureTable(mSdcard + mShapefilePath); mFlayer = new FeatureLayer(shpFileFeatTable); mFlayer.setRenderer(new SimpleRenderer(new SimpleMarkerSymbol(Color.CYAN, 2, STYLE.SQUARE))); mMapView.addLayer(mFlayer); } catch (FileNotFoundException e) { Toast.makeText(getApplicationContext(), "File not found in SDCard, nothing to load", Toast.LENGTH_LONG) .show(); } catch (RuntimeException e) { Log.d("**ShapefileTest**", "File not found in SDCard, nothing to load"); Toast.makeText(getApplicationContext(), "File not found in SDCard, nothing to load", Toast.LENGTH_LONG) .show(); }
أكثر...
I downloaded shapefile fromhttps://docs.google.com/uc?id=0B0kRhiw4fD7uQzU3MzBMRzFfSFk&export=download

My code:layout.xml
MapActivity.java
mMapView = (MapView) findViewById(R.id.map); mMapView.enableWrapAround(true); String mShapefilePath = "/london_buildings/TQTL_LON.shp"; String mSdcard = Environment.getExternalStorageDirectory().getPath(); mMapView = (MapView) findViewById(R.id.map); ArcGISTiledMapServiceLayer mTiledlayer = new ArcGISTiledMapServiceLayer( "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"); mMapView.addLayer(mTiledlayer); try { shpFileFeatTable = new ShapefileFeatureTable(mSdcard + mShapefilePath); mFlayer = new FeatureLayer(shpFileFeatTable); mFlayer.setRenderer(new SimpleRenderer(new SimpleMarkerSymbol(Color.CYAN, 2, STYLE.SQUARE))); mMapView.addLayer(mFlayer); } catch (FileNotFoundException e) { Toast.makeText(getApplicationContext(), "File not found in SDCard, nothing to load", Toast.LENGTH_LONG) .show(); } catch (RuntimeException e) { Log.d("**ShapefileTest**", "File not found in SDCard, nothing to load"); Toast.makeText(getApplicationContext(), "File not found in SDCard, nothing to load", Toast.LENGTH_LONG) .show(); }
أكثر...