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

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

@deepak07dbz

Description

@deepak07dbz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions