3

I found some code to view a offline map using a .map file. But I can't find a way to create a .map file or to generate one for a specific city or state. Can anybody tell me how to create or generate a .map file for particular city or state? My code for showing a offline map using a .map file is given below:

public class HelloMapView extends MapActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MapView mapView = new MapView(this);
        mapView.setClickable(true);
        mapView.setBuiltInZoomControls(true);
        mapView.setMapFile(new File("/sdcard/path/to/mapfile.map"));
        setContentView(mapView);
    }
}

I am unable to create a .map file so please provide me a solution for this asap.

JJD
  • 50,076
  • 60
  • 203
  • 339
Ramesh Solanki
  • 2,961
  • 4
  • 28
  • 44

7 Answers7

3

First you need to get OpenStreetMap data for specific city, state or country. You can find links to area extracts here: http://wiki.openstreetmap.org/wiki/Planet.osm#Country_and_area_extracts . I'd recommend getting data in PBF, because it is usually a smaller download. If you need smaller or specific area, which is not provided, you can cut it out using osmosis during conversion (see bounding box/polygon in Osmosis wiki).

Next you will need to convert that data to mapsforge map format. It is done with Osmosis ( http://wiki.openstreetmap.org/wiki/Osmosis#Latest_Stable_Version ) and mapsforge map-writer plugin ( http://code.google.com/p/mapsforge/downloads/list ). Plugin installation instructions are here: http://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter . In short - extract Osmosis, inside osmosis directory create new directory plugins and copy map-writer.jar there. Now, from command line execute something like this:

$ bin/osmosis --rb file=../data/berlin.osm.pbf --mapfile-writer file=/tmp/berlin.map
joshas
  • 1,464
  • 1
  • 24
  • 41
1

you can find list of maps here used by mapsforge

Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51
1

you can use this I have used this in many application....

http://leaflet.cloudmade.com/

Chirag Patel
  • 11,416
  • 3
  • 26
  • 38
1

You could also have a look at open source map for android. There is a tilesource implementation that dwells on a bitmap, it could be used for your purpose.

Snicolas
  • 37,840
  • 15
  • 114
  • 173
1

It's all answered in the mapsforge wiki:

http://code.google.com/p/mapsforge/wiki/MapFileWriterOsmosis

If you need more help, I'd recommend to use the project's mailing list:

http://groups.google.com/group/mapsforge-dev?pli=1

Karsten
  • 34
  • 1
0

I think you want to make an android application for showing specify map offline, this is a nice tutorial. http://www.haakseth.com/?p=30

The first thing you have to do is generate map of city you want to show with Mobile Atlas Creator (MOBAC) application. Then you can render the map in to map view.

arif ardiansyah
  • 517
  • 4
  • 7
0

go to http://download.mapsforge.org/maps/ for .map files

and go to http://download.geofabrik.de/index.html for .osm/pbf files that gives additional features (offline reverse geocoding, places, buildings, names, streets, etc...)
Use mapsforge/graphhopper plugin

MJakhongir
  • 2,101
  • 2
  • 16
  • 27