small improvement
git-svn-id: https://osmand.googlecode.com/svn/trunk@305 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
ff38418d90
commit
c4d79fa614
1 changed files with 41 additions and 39 deletions
|
@ -32,7 +32,7 @@ public class IndexBatchCreator {
|
||||||
protected static final String[] countriesToDownload1 = new String[] {
|
protected static final String[] countriesToDownload1 = new String[] {
|
||||||
// "albania", "andorra", "austria", // 5.3, 0.4, 100 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
// "albania", "andorra", "austria", // 5.3, 0.4, 100 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// "belarus", "belgium", "bosnia-herzegovina", // 39, 43, 4.1 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
// "belarus", "belgium", "bosnia-herzegovina", // 39, 43, 4.1 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
"bulgaria", "croatia", "cyprus", // 13, 12, 5 //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
// "bulgaria", "croatia", "cyprus", // 13, 12, 5 //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// "denmark", "estonia", "faroe_islands", // 75, 38, 1.5 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
// "denmark", "estonia", "faroe_islands", // 75, 38, 1.5 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// "finland", "greece", "hungary", //80, 25, 14 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
// "finland", "greece", "hungary", //80, 25, 14 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
// "iceland", "ireland", "isle_of_man", // 5.9, 27, 1.1 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
// "iceland", "ireland", "isle_of_man", // 5.9, 27, 1.1 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
|
@ -59,14 +59,14 @@ public class IndexBatchCreator {
|
||||||
protected static final String SITE_TO_DOWNLOAD2 = "http://downloads.cloudmade.com/"; //$NON-NLS-1$
|
protected static final String SITE_TO_DOWNLOAD2 = "http://downloads.cloudmade.com/"; //$NON-NLS-1$
|
||||||
// us states
|
// us states
|
||||||
protected static final String[] usStates = new String[] {
|
protected static final String[] usStates = new String[] {
|
||||||
// "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
|
"Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
|
||||||
// "Delaware", "District_of_Columbia", "Florida", "Georgia", "Guantanamo_Bay", "Hawaii",
|
"Delaware", "District_of_Columbia", "Florida", "Georgia", "Guantanamo_Bay", "Hawaii",
|
||||||
// "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine",
|
"Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine",
|
||||||
// "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri",
|
"Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri",
|
||||||
// "Montana", "Nebraska", "Nevada", "New_Hampshire", "New_Jersey", "New_Mexico",
|
"Montana", "Nebraska", "Nevada", "New_Hampshire", "New_Jersey", "New_Mexico",
|
||||||
// "New_York", "North_Carolina", "North_Dakota", "Ohio", "Oklahoma", "Oregon",
|
"New_York", "North_Carolina", "North_Dakota", "Ohio", "Oklahoma", "Oregon",
|
||||||
// "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee",
|
"Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee",
|
||||||
// "Texas", "Utah", "Vermont", "Virginia", "Washington", "West_Virginia", "Wisconsin", "Wyoming",
|
"Texas", "Utah", "Vermont", "Virginia", "Washington", "West_Virginia", "Wisconsin", "Wyoming",
|
||||||
};
|
};
|
||||||
protected static final String[] canadaStates = new String[] {
|
protected static final String[] canadaStates = new String[] {
|
||||||
// "Alberta","British_Columbia","Manitoba","New_Brunswick","Newfoundland",
|
// "Alberta","British_Columbia","Manitoba","New_Brunswick","Newfoundland",
|
||||||
|
@ -137,6 +137,7 @@ public class IndexBatchCreator {
|
||||||
File f = new File(osmDirFiles, country +".osm.bz2");
|
File f = new File(osmDirFiles, country +".osm.bz2");
|
||||||
downloadFile(url, f); //$NON-NLS-1$
|
downloadFile(url, f); //$NON-NLS-1$
|
||||||
generateIndex(f, alreadyGeneratedFiles, alreadyUploadedFiles);
|
generateIndex(f, alreadyGeneratedFiles, alreadyUploadedFiles);
|
||||||
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String country : usStates){
|
for(String country : usStates){
|
||||||
|
@ -192,13 +193,7 @@ public class IndexBatchCreator {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (f.getName().endsWith(".osm.bz2") || f.getName().endsWith(".osm")) {
|
if (f.getName().endsWith(".osm.bz2") || f.getName().endsWith(".osm")) {
|
||||||
System.gc();
|
|
||||||
try {
|
|
||||||
generateIndex(f, alreadyGeneratedFiles, alreadyUploadedFiles);
|
generateIndex(f, alreadyGeneratedFiles, alreadyUploadedFiles);
|
||||||
} catch (OutOfMemoryError e) {
|
|
||||||
log.error("OutOfMemory", e);
|
|
||||||
System.gc();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("GENERATING INDEXES FINISHED ");
|
System.out.println("GENERATING INDEXES FINISHED ");
|
||||||
|
@ -207,6 +202,7 @@ public class IndexBatchCreator {
|
||||||
if (!generateIndexes) {
|
if (!generateIndexes) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
DataExtraction extr = new DataExtraction(indexAddress, indexPOI, indexTransport, indexAddress, false, false, indexDirFiles);
|
DataExtraction extr = new DataExtraction(indexAddress, indexPOI, indexTransport, indexAddress, false, false, indexDirFiles);
|
||||||
try {
|
try {
|
||||||
alreadyGeneratedFiles.add(f.getName());
|
alreadyGeneratedFiles.add(f.getName());
|
||||||
|
@ -231,6 +227,12 @@ public class IndexBatchCreator {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Exception generating indexes for " + f.getName()); //$NON-NLS-1$
|
log.error("Exception generating indexes for " + f.getName()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
} catch (OutOfMemoryError e) {
|
||||||
|
System.gc();
|
||||||
|
log.error("OutOfMemory", e);
|
||||||
|
|
||||||
|
}
|
||||||
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected File[] getSortedFiles(File dir){
|
protected File[] getSortedFiles(File dir){
|
||||||
|
|
Loading…
Reference in a new issue