Issue
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.
Solution
Couple of things to check:
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.Method
fromWgs84(47.0f, 9.0f)
should have order longitude (x, easting), latitude (y, northing). Make sure this is correct.
Answered By - JaakL
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.