Discussion:
Error: Could not find or load main class net.osmand.util.IndexBatchCreator
Eric Gagne
2018-11-16 14:53:08 UTC
Permalink
Hello,

I wonder if anyone can help me with that. I just can't figure out what I
am doing wrong. I get that message both in Linux and Windows.


Command line.
java -Djava.util.logging.config.file=logging.properties -Xms256M -Xmx12G
-cp "./OsmAndMapCreator.jar:./lib/OsmAnd-core.jar:./lib/*.jar"
net.osmand.util.IndexBatchCreator ./batch.xml

I also tried
java -cp "./OsmAndMapCreator.jar:./lib/OsmAnd-core.jar:./lib/*.jar"
net.osmand.util.IndexBatchCreator batch.xml


My osm file is /mnt/d/osmand/qosm.osm and I know it's valid file because it
works just fine when I run the GUI osmandmapcreator

Batch.xml

<?xml version="1.0" encoding="utf-8"?>
<batch_process>
<process_attributes
mapZooms="7;8;9;10;11;12;13-14;15-"
renderingTypesFile="/mnt/d/osmand/rendering_types.xml"
zoomWaySmoothness="2"
osmDbDialect="sqlite"
mapDbDialect="sqlite"/>

<!-- There are 3 subprocess :
1. Download fresh osm files from servers to 'directory_for_osm_files'
(override existings).
2. Generate index files from all files in 'directory_for_osm_files' and put
all indexes into 'directory_for_index_files'
3. Upload index files from 'directory_for_index_files' to googlecode.
If directory directory_for_uploaded_files is specified all uploaded files
will be moved to it
All these subprocess could be ran independently ! So you can create some
files check them and after that try to upload on googlecode,
or you can upload any file you have to googlecode (just put into
'directory_for_index_files')
-->
<!-- zoomWaySmoothness - 1-4, typical mapZooms - 11;12;13-14;15- -->
<!--
<process directory_for_osm_files="/home/..."
directory_for_index_files="/home/..." directory_for_generation="/home/..."
skipExistingIndexesAt="/home/..." directory_for_srtm_files="/home/..."
indexPOI="true" indexRouting="true" indexMap="true"
indexTransport="true" indexAddress="true">
-->
<process
directory_for_osm_files="/mnt/d/OsmAnd"
directory_for_index_files="/mnt/d/OsmAnd"
directory_for_generation="/mnt/d/OsmAnd"
skipExistingIndexesAt="/mnt/d/OsmAnd"
directory_for_srtm_files="/mnt/d/OsmAnd"
indexPOI="true"
indexRouting="true"
indexMap="true"
indexTransport="true"
indexAddress="true">

<!-- Add wget="C:/Program Files/GNUWin32/bin/wget.exe" to process, to use
wget for download.
On linux systems if wget is in your path it can be wget="wget" or you can
make own script with wget command:
wget="/path/to/script/wget.sh"
Defaultly enabled parameter of wget is: &-&-read-timeout=5 that prevents
hanging of download from cloudmade/geofabrik server
-->

</process>
</batch_process>
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nelson A. de Oliveira
2018-11-16 15:22:02 UTC
Permalink
I wonder if anyone can help me with that. I just can't figure out what I am doing wrong. I get that message both in Linux and Windows.
Can you try this?
https://github.com/osmandapp/OsmAnd-tools/issues/249#issuecomment-402459884
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Gagne
2018-11-16 15:39:02 UTC
Permalink
Hello Nelson,
Thank you, this is helpful.

Running ./utilities.sh generate-obf /mnt/d/osmand/qosm.osm seems to be
working, the file is over 2 GB so it will take a while before I know if it
runs through.

./utilities.sh generate-obf-files-in-batch batch.xml show me a list of
available commands and generate-obf-files-in-batch was not one of them but
I know I am not running the latest osmandmapcreator so that's probably the
reason why.

I am just wondering, using utilities.sh, how does the program know what
zooms and rendering_types file to use ?
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nelson A. de Oliveira
2018-11-16 15:42:20 UTC
Permalink
I am just wondering, using utilities.sh, how does the program know what zooms and rendering_types file to use ?
From your batch.xml :-)

See that you are passing it as parameter to utilities.sh:

./utilities.sh generate-obf-files-in-batch batch.xml
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Gagne
2018-11-16 17:08:52 UTC
Permalink
So my obf file was created but it's about 10% (30 MB) smaller than when I
run the GUI. I think it's missing zoom levels because in my android
tablet, I can't see thinks at zoom levels below 11.
I downloaded the latest osmanandmapcreator but it looks like something is
wrong with the zip file, there is no OsmAndMapCreator.jar file in it so I
cannot try generate-obf-files-in-batch.
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nelson A. de Oliveira
2018-11-16 17:14:11 UTC
Permalink
So my obf file was created but it's about 10% (30 MB) smaller than when I run the GUI. I think it's missing zoom levels because in my android tablet, I can't see thinks at zoom levels below 11.
The default batch.xml file has empty values for mapZooms and zoonWaySmoothness:

<process_attributes mapZooms="" renderingTypesFile=""
zoomWaySmoothness=""
osmDbDialect="sqlite" mapDbDialect="sqlite"/>

If you use these same settings in your batch.xml, do you still see a
significant difference in size?
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Gagne
2018-11-16 17:52:43 UTC
Permalink
I think I did not explain myself correctly. I cannot use the batch.xml
file, my copy does not have generate-obf-file-in-batch function.
$ ./utilities.sh
This utility provides access to all other console utilities of OsmAnd,
each utility has own argument list and own synopsys. Here is the list:
generate-obf <path to osm file>: simple way to generate
obf file in place. Another supported options
generate-map, generate-address, generate-poi, generate-roads (generate obf
partially)
check-ocean-tile <lat> <lon> <zoom=11>: checks ocean or
land tile is in bz2 list
generate-ocean-tile <coastline osm file> <optional output
file>: creates ocean tiles 12 zoom
generate-java-style <pathtostyle> <pathtooutputfolder>:
prints rendering style as java interpreted code
explain-rendering-style <pathtostyle>: prints explanation
of the style
merge-flat-obf <path to result file> <paths to files to
merge (>2)>: merges all data from 2+ obf files (address not supported)
split-obf <path_to_world_obf_diff> <path_to_result_folder>
<path_to_regions.ocbf> <subfolder_name> <file_suffix>: splits a world_obf
into obf region files
generate-obf-diff <path_old_obf> <path_new_obf>
<name_or_path_diff_obf or stdout>: generates obf diff file between 2 obf
files (address not supported), stdout prints to console
test-routing <own list of parameters>: helps to run
routing test for specific locations
generate-ocbf <path to osmand/repos/ repository>:
generates regions.ocbf file, this path should contain folders 'misc',
'tools', 'resources'
delete-unused-strings <path to repos/android/OsmAnd/res>:
deletes unused translation in git repository (transforms all strings.xml)
extract-roads-only <path to full map obf file> : extracts
.road.obf (road-only map) file from full .obf
generate-osmlive-tests
<path_to_directory_with_resources_project> <optional_path_to_unpack_files>:
test osmand live functionality
generate-region-tags <path to input osm file (osm, bz2,
gz)> <path to output osm file> <path to ocbf file>: process osm file and
assign tag osmand_region_name to every entity.
generate-ocean-tile-osm <optional path to osm file to
write> <optional path to oceantiles_12.dat file>: generates ocean tiles osm
file to check in JOSM
merge-index output_file.obf [--address] [--poi]
[input_file.obf] ...: merges all obf files and merges poi & address
structure into 1
compare [--cities] [--city-names] [--streets]
[--street-names] [--buildings] [--intersections] [--poi] [--poi-details]
[--osm=file_path] [--add] [--rm] <first> <second>: compare <first> and
<second> (map & routing data is not supported)
generate-from-overpass <path to overpass.xml (must have
format 2017_06_18-10_30)> <path to working directory> <path to
regions.ocbf>: The utility converts overpass.xml to obf
I downloaded latest version but it does not work, it's missing the
osmandmapcreator.jar file

$ ./utilities.sh
Error: Could not find or load main class net.osmand.MainUtilities

$ ls -ltr
total 12
drwxrwxrwx 1 eric eric 512 Nov 16 12:06 lib
drwxrwxrwx 1 eric eric 512 Nov 16 12:06 fonts
-rwxrwxrwx 1 eric eric 1613 Nov 16 12:06 batch.xml
-rwxrwxrwx 1 eric eric 623 Nov 16 12:06 logging.properties
-rwxrwxrwx 1 eric eric 282 Nov 16 12:06 inspector.sh
-rwxrwxrwx 1 eric eric 224 Nov 16 12:06 OsmAndMapCreator.sh
-rwxrwxrwx 1 eric eric 182 Nov 16 12:06 OsmAndMapCreator.bat
-rwxrwxrwx 1 eric eric 148 Nov 16 12:06 inspector.bat
-rwxrwxrwx 1 eric eric 258 Nov 16 12:06 utilities.bat
-rwxrwxrwx 1 eric eric 612 Nov 16 12:06 utilities.sh
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Gagne
2018-11-17 15:15:05 UTC
Permalink
I have been googling around and found this,
https://code.google.com/archive/p/osmand/wikis/CreateOfflineMapsForYourself.wiki
and it works, I just changed the memory settings


java -Djava.util.logging.config.file=logging.properties -Xms256M -Xmx12G
-cp "./OsmAndMapCreator.jar:./lib/OsmAnd-core.jar:./lib/*.jar"
net.osmand.data.index.IndexBatchCreator ./batch.xml
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Eric Gagne
2018-12-05 01:42:34 UTC
Permalink
My solution above works for Linux but I found out today that I does not under Windows. As I don't know know much about java it took me a while to figure out the problem.

I am posting in case it could help others. In Windows the separator for directories in the -co argument is a semi colon, not a colon. This works for me on will does 10.


java -Djava.util.logging.config.file=logging.properties -Xms256M -Xmx12G -cp "./OsmAndMapCreator.jar;./lib/OsmAnd-core.jar;./lib/*.jar" net.osmand.data.index.IndexBatchCreator ./batch.xml
--
You received this message because you are subscribed to the Google Groups "Osmand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osmand+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...