Offline map in android using .map file

I found code to view an offline map using a .map file. But I can't seem to find a way to create a .map file or create one for a specific city or state. Can anyone tell me how to create or generate a .map file for a specific city or state? My code for displaying an offline map using a .map file is 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 cannot create a .map file, so please provide me with a solution for this as soon as possible.

+3


source to share


7 replies


First you need to get OpenStreetMap data for a specific city, state or country. You can find links to excerpts from the area here: http://wiki.openstreetmap.org/wiki/Planet.osm#Country_and_area_extracts . I would recommend fetching data in PBF, because it is usually less load. If you need a smaller or specific area that is not provided, you can cut it out with osmosis during conversion (see Bounding Rectangle / Polygon in wmws Osmosis).

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



$ bin/osmosis --rb file=../data/berlin.osm.pbf --mapfile-writer file=/tmp/berlin.map

      

+3


source


you can use this, i have used this in many applications ....



http://leaflet.cloudmade.com/

+1


source


You can also look at the open source map for android . There is a source cache implementation that stops at a bitmap, it can be used for your purpose.

+1


source


This is all answered in the mapsforge wiki page:

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

If you need more help, I would recommend using the project mailing list:

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

+1


source


you can find a list of maps here used for mapsforge

+1


source


I think you want the android app to show it is listed offline, this is a good tutorial. http://www.haakseth.com/?p=30

The first thing you need to do is create the city map you want to show using the Mobile Atlas Creator (MOBAC) app. Then you can display the map to display the map.

0


source


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

and go to http://download.geofabrik.de/index.html for .osm / pbf files that provide additional functionality (offline reverse geocoding, places, buildings, names, streets, etc.)

Use mapsforge / graphhopper plugin

0


source







All Articles