Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

[VTM] offline map loading failure, tileSource.getMapInfo() returning null #187

Open
deepak07dbz opened this issue Apr 27, 2024 · 1 comment

Comments

@deepak07dbz
Copy link

void loadMap(File areaFolder) {
//map event receiver
mapView.map().layers().add(new MapEventsReceiver(mapView.map()));

    //map file source
    MapFileTileSource tileSource = new MapFileTileSource();
    File mapFile = new File(areaFolder, AREA + ".map").getAbsoluteFile();
    tileSource.setMapFile(String.valueOf(mapFile));
    Log.d("LOAD", "loadMap: " + mapFile.exists());
    VectorTileLayer l = mapView.map().setBaseMap(tileSource);
    mapView.map().setTheme(VtmThemes.DEFAULT);
    mapView.map().layers().add(new BuildingLayer(mapView.map(), l));
    mapView.map().layers().add(new LabelLayer(mapView.map(), l));

    //marker's layer
    itemLayer = new ItemizedLayer<>(mapView.map(), (MarkerSymbol) null);
    mapView.map().layers().add(itemLayer);

    //map position
    MapInfo mapInfo = tileSource.getMapInfo();
    if (mapInfo == null) {
        Log.d("LOAD", "loadMap: null mapinfo");
    } else if (mapInfo.boundingBox == null) {
        Log.d("LOAD", "loadMap: bbox is null");
    } else {
        GeoPoint mapCenter = tileSource.getMapInfo().boundingBox.getCenterPoint();
        mapView.map().setMapPosition(mapCenter.getLatitude(), mapCenter.getLongitude(), 1 << 17);
        //mapView.map().setMapPosition(18.551576, 73.831151, 1 << 17);
        setContentView(mapView);
        //loadGraph();
    }
}

//mapFile exists and is a valid file

@hjanetzek
Copy link
Member

Hello - development is continued at https://github.com/mapsforge/vtm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants