0

Referring to this site, I built my MapActivity as following:

public class MainActivity extends Activity {

    private MapView mapView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mapView = (MapView) findViewById(R.id.map);
        mapView.setComponents(new Components());

        RasterDataSource datasource = new PackagedRasterDataSource(new EPSG3857(), 11, 12, "t{zoom}_{x}_{y}", getApplicationContext());
        RasterLayer mapLayer = new RasterLayer(datasource, 16);
        mapView.getLayers().setBaseLayer(mapLayer);
        mapView.setFocusPoint(mapView.getLayers().getBaseLayer().getProjection().fromWgs84(47.0f, 9.0f));
        //mapView.setZoom(15);
    }

    @Override
    protected void onStart(){
        super.onStart();
        mapView.startMapping();
    }

    @Override
    protected void onStop(){
        mapView.stopMapping();
        super.onStop();
    }

}

I have put tiles in my res/raw folder, but however nothing is shown. Is there anything I am missing? According to the tutorial, it must show something. What else could I provide to debug it? The xml is a simple MapView with width and height.

The tiles are generated here and here. As parameters I set no CloudMade Key.

JaakL
  • 4,107
  • 5
  • 24
  • 37
Valentino Ru
  • 4,964
  • 12
  • 43
  • 78

1 Answers1

4

Couple of things to check:

  1. Your new PackagedRasterDataSource(new EPSG3857(), 11, 12 ... defines that the data is for zoom levels 11-12, so you should have "t11_x_y.png" etc, with proper x and y, in your tile set, and map zoomed and centered to area covered with tiles.

  2. Method fromWgs84(47.0f, 9.0f) should have order longitude (x, easting), latitude (y, northing). Make sure this is correct.

JaakL
  • 4,107
  • 5
  • 24
  • 37
  • I have tried the above.. My map still doesn't show up.. Any clues? And what do you mean by "centered to area covered with tiles" – Prasanna Aarthi Nov 20 '14 at 09:46
  • I would need to see your project (at least tiles). Most probably you zoom and center map to location where there is no map (are no tiles). – JaakL Nov 23 '14 at 16:25