Nutiteq Android- Offline map is not displaying

171 views Asked by At

Here is my code

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

        mapView = (MapView) findViewById(R.id.mapView);
        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(217884.21f, 1928068.13f));
        //mapView.setZoom(15);
    }

I have added .map file from http://www.mapcacher.com/ and converted it to PNG using http://dev.nutiteq.ee/jarmaps/ . I have mentioned the correct zoom level, checked that t11 and t12 files exist under res/raw. Also I have converted lat/lon to the required format using http://www.latlong.net/lat-long-utm.html . What is it that I am doing wrong.I don't get any errors in log cat but a blank page with Nutiteq logo is diplayed.

1

There are 1 answers

2
JaakL On

This line is wrong, instead of UTM coordinates

mapView.setFocusPoint(mapView.getLayers().getBaseLayer().getProjection().fromWgs84(217884.21f, 1928068.13f));

you should use WGS84, lat-long coordinates (first parameter long as x, then lat as y), like method name fromWgs84 suggests. No need to convert from/to UTM externally.