Edit Mapsforge MAPS

799 views
Skip to first unread message

charles galvez

unread,
Oct 12, 2015, 2:23:49 AM10/12/15
to mapsforge-dev
I'm Creating an Offline Map for Android.But i only need a certain part of the Map.At the moment I can View my whole country using Mapsforge.
The map is provided by Mapsforge.What I want is to get some continent of my country.I Don't want to use MOBAC.(too large file) Thank you!

Emux

unread,
Oct 12, 2015, 2:35:52 AM10/12/15
to mapsfo...@googlegroups.com
You can recreate the map with the map-writer Osmosis plugin, using a bounding box and limiting the map file at the desired area.
We have examples in the Wiki guides.

--
Emux

charles galvez

unread,
Oct 12, 2015, 2:47:45 AM10/12/15
to mapsforge-dev
Is there any software that can just cut certain part of the map?

Emux

unread,
Oct 12, 2015, 2:53:53 AM10/12/15
to mapsfo...@googlegroups.com
Raster maps or vector maps?

For raster maps there can be many (as MOBAC).

For vector maps you need to use Osmosis with map-writer plugin.
Input osm files can be found at Geofabrik.

--
Emux

charles galvez

unread,
Oct 12, 2015, 3:21:55 AM10/12/15
to mapsforge-dev
I cant understand the installation for osmosis. is there any video tutorial for that?


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 3:57:55 AM10/12/15
to mapsfo...@googlegroups.com
Osmosis is a 'generic' Java OSM tool, so many guides can be found online.

For map building it can be used simply by unzipping it and putting the map-writer plugin jar in its osmosis/lib/default/ subfolder.

Then proceeding with the proper command line.

--
Emux

charles galvez

unread,
Oct 12, 2015, 5:34:57 AM10/12/15
to mapsforge-dev
If i use OSMOSIS can i use it to copy certain part of the map and use it with mapsforge? thanks


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 5:37:22 AM10/12/15
to mapsfo...@googlegroups.com
On 12/10/2015 12:34 μμ, charles galvez wrote:
If i use OSMOSIS can i use it to copy certain part of the map and use it with mapsforge? thanks

Create a new map file yes (not modify/copy an existing one).

--
Emux

charles galvez

unread,
Oct 12, 2015, 6:10:52 AM10/12/15
to mapsforge-dev
Thank you for your help. I still cant find Step by step tutorial. 
I Followed this tutorial on how to install OSMOSIS but I didn't get the result shown on this link. Osmosis Installation Link-
I Extracted the osmosis-latest.zip C then followed the instruction.


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

charles galvez

unread,
Oct 12, 2015, 6:30:09 AM10/12/15
to mapsforge-dev

This is always what i got when following the instruction.


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 6:32:14 AM10/12/15
to mapsfo...@googlegroups.com
Try putting Osmosis in a dir path without spaces.

--
Emux

charles galvez

unread,
Oct 12, 2015, 6:45:49 AM10/12/15
to mapsforge-dev

I Hope I did what you are saying in this Image. 
I extracted the osmosis in my downloads and does the Instruction for installing osmosis.


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 6:49:38 AM10/12/15
to mapsfo...@googlegroups.com
Osmosis is not a Window UI application, but a command line tool.

So you must run it in a shell (command prompt).
Also either put its bin folder in the environment path (to run it from everywhere) or be in its 'bin' subfolder and then run it.

--
Emux

charles galvez

unread,
Oct 12, 2015, 7:11:52 AM10/12/15
to mapsforge-dev


Still getting this error. 

On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 7:23:24 AM10/12/15
to mapsfo...@googlegroups.com
Apparently there is some version error in osmosis.bat file.

Check for a solution here:
https://lists.openstreetmap.org/pipermail/osmosis-dev/2015-June/001695.html

--
Emux

charles galvez

unread,
Oct 12, 2015, 7:28:29 AM10/12/15
to mapsforge-dev
Thank you so much!
That solved my problem. 
Now i'll study how to use Osmosis! thanks.

On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

charles galvez

unread,
Oct 12, 2015, 8:06:05 AM10/12/15
to mapsforge-dev
is this necessary,
putting this line of code in osmosis.bat?
"IF "%JAVACMD%"=="" set JAVACMD="C:\Program Files (x86)\Java\jre7\bin\java" 
thanks.

On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 8:08:45 AM10/12/15
to mapsfo...@googlegroups.com
It's usually recommended to have set JAVA_HOME and have java exe in the path.

But Osmosis should work without changes.

--
Emux

charles galvez

unread,
Oct 12, 2015, 8:16:55 AM10/12/15
to mapsforge-dev


Thank you. just to be sure am I getting the result correct? I write some code base on the tutorial but gave me some error.

On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 8:18:51 AM10/12/15
to mapsfo...@googlegroups.com
Can you provide the command line?

--
Emux

charles galvez

unread,
Oct 12, 2015, 8:50:44 AM10/12/15
to mapsforge-dev

Sorry for so many questions i have to ask. This is my first time using this. Thank you


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

charles galvez

unread,
Oct 12, 2015, 8:57:26 AM10/12/15
to mapsforge-dev
BTW. I downloaded the mapsforge-map-writer-dev-SNAPSHOT.jar and Paste it to osmosis\lib\default.


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 8:57:44 AM10/12/15
to mapsfo...@googlegroups.com
(try posting text command examples via copy/paste, not images)

A simplest map creation command with bounding box is:

osmosis --rb file=country.pbf --mw file=country.map bbox=minLat,minLon,maxLat,maxLon map-start-position=lat,lon map-start-zoom=14

--
Emux

charles galvez

unread,
Oct 12, 2015, 9:21:58 AM10/12/15
to mapsforge-dev
Sorry. It says 'Osmosis' is not recognized as an internal or external command.


On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Emux

unread,
Oct 12, 2015, 9:24:27 AM10/12/15
to mapsfo...@googlegroups.com
Put osmosis.bat in windows and run it with the proper paths.

--
Emux

charles galvez

unread,
Oct 12, 2015, 9:45:33 AM10/12/15
to mapsforge-dev
I put it in windows and change the path and run the command like what you have given. but nothing happens.
C:\Windows>osmosis --rb file=philippines.osm.pbf --mw file=country.map bbox=13.0
00,122.00,13.000,122.0000 map-start-position=13.0000,122.0000 map-start-zoom=14

On Monday, October 12, 2015 at 2:23:49 PM UTC+8, charles galvez wrote:

Ludwig

unread,
Oct 12, 2015, 9:47:32 AM10/12/15
to mapsfo...@googlegroups.com
I do not know what else is wrong, but if you just extract a single point from a map, I would not expect too much. 

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapsforge-dev/ed70a3ea-c223-4ea1-bf21-668cd4e8516b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

charles galvez

unread,
Oct 12, 2015, 9:54:14 AM10/12/15
to mapsforge-dev
What do you mean sir?  Yes thats what i want. I want to extract some place in the map then use it in mapsforge.

Emux

unread,
Oct 12, 2015, 9:54:18 AM10/12/15
to mapsfo...@googlegroups.com
(You seem playing inside Windows folder?)

Make a clean folder, copy inside the osmosis and pbf and run from there.
It's better setting absolute paths as parameters, just to be sure.

Also post (copy/paste) the result for us to understand the problem.

--
Emux

Emux

unread,
Oct 12, 2015, 9:59:08 AM10/12/15
to mapsfo...@googlegroups.com
Ludwig is right, you cannot extract an area where min limits are equal with max limits.

That's a bounding box expressed as a point, the bounding box must have a surface size.

Try something like that:
bbox=12.5,121.5,13.5,122.5

--
Emux
Message has been deleted

charles galvez

unread,
Oct 12, 2015, 10:07:34 AM10/12/15
to mapsforge-dev
Should I just start from the beginning of the tutorial,
   or should i make a folder inside windows and run the osmosis.bat using the shortcut i created? 
  This is what i get when i put osmosis.bat and the shortcut that runs the osmosis.bat(based on the tutorial i should make a shortcut)
C:\Windows>"C:\Windows\osmosis.bat"
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
    -hotspot      is a synonym for the "server" VM  [deprecated]
                  The default VM is server.

    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A ; separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument

    -splash:<imagepath>
                  show splash screen with specified image

 

charles galvez

unread,
Oct 12, 2015, 10:10:34 AM10/12/15
to mapsforge-dev
I get this when i changed the bbox values.
Im running osmosis.bat (using shortcut.bat).
C:\Windows>osmosis --rb file=philippines.osm.pbf --mw file=country.map bbox=13.0
00,122.00,13.000,122.0000 map-start-position=13.0000,122.0000 map-start-zoom=14

charles galvez

unread,
Oct 12, 2015, 8:14:36 PM10/12/15
to mapsforge-dev
Someone pls. I still need Help.
Or you can run Team Viewer for me. :'(

Emux

unread,
Oct 13, 2015, 1:43:11 AM10/13/15
to mapsfo...@googlegroups.com
I recommend to take it step by step and run the commands in a shell.
When you run it successfully you can create a batch file of them.

So again, place in a clean folder the osmosis directory with the map-writer plugin in osmosis/lib/default/ subfolder, and the country pbf. Then run:

osmosis\bin\osmosis.bat --rb file=country.pbf --mw file=country.map bbox=minLat,minLon,maxLat,maxLon map-start-position=lat,lon map-start-zoom=14

Note: put proper bounding box coordinates (i.e. not equal min/max).

In case of error, provide the full command line you use and the command prompt log (right click copy/paste).

--
Emux
Reply all
Reply to author
Forward
0 new messages