user995598
user995598

Reputation: 41

Creating .map file with mapfilewriter plugin for osmosis

I tried to make a .map file to use it in my android application. My point is to show map on screen with help of mapsforge library. Library requires a .map file. The problem is generating it with osmosis mapfilewriter plugin. When I use command

./osmosis --rx file=/home/user/poland.osm --mw file=result.map bbox=51.09,16.9,51.14,17

I get

SEVERE: Thread for task 1-rx failed
java.lang.OutOfMemoryError: Java heap space

I tried using another order of arguments but it also doesn't work. I also tried using -Xmx1200m option to increase javas heap memory but usage of memory was this same and didn't help.

I would be grateful for help.

Upvotes: 4

Views: 1298

Answers (2)

Piskvor left the building
Piskvor left the building

Reputation: 92772

If you have enough memory, you need to tell Java about it (it will only use a limited amount otherwise); but this is not an argument passed directly to osmosis.

On Windows, you can follow this advice given by Emilie Laffray on the OSM-dev list:

In osmosis.bat is the following line... REM # JAVACMD_OPTIONS - The options to append to the java command, typically used to modify jvm settings such as max memory.

so, either modify osmosis.bat or, create a new file called osmosis.bat in the all users profile directory or your profile directory, to include a 'set JAVACMD_OPTIONS = -Xmx1024M' line (to set maximum memory usage to 1GB, if you have enough RAM)...

On Linux (and I'd assume Mac OS X also), you can create the file ~/.osmosis containing the line

JAVACMD_OPTIONS=-Xmx1024M 

which will be loaded by osmosis on startup. Note that both examples above use the value 1024M, i.e. you're giving Java access to 1024 MB of RAM - you could use a different value depending on your system.

Upvotes: 2

Mas
Mas

Reputation: 4606

Use the parameter type=hd.

The type parameter has two options ram and hd. Although I don't see that the documentation doesn't explicitly state what hd means, I would guess it means "hard disk", meaning it would offload data to disk, rather than keeping it all in memory.

The resulting command would be then:

./osmosis --rx file=/home/user/poland.osm --mw file=result.map bbox=51.09,16.9,51.14,17 type=hd

Upvotes: 3

Related Questions