From cbb2a10a0855428b7c75ab73391bd7a683fda79e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 6 Jul 2010 20:53:06 +0000 Subject: [PATCH] add us & canada to index git-svn-id: https://osmand.googlecode.com/svn/trunk@293 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- .../src/com/osmand/ToDoConstants.java | 14 +++--- .../osmand/data/index/IndexBatchCreator.java | 48 +++++++++++++++++-- .../com/osmand/activities/MapActivity.java | 2 +- 3 files changed, 52 insertions(+), 12 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index 703f334542..e9fbfe4044 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -13,16 +13,14 @@ public class ToDoConstants { */ public int DESCRIBE_ABOUT_AUTHORS = 8; - // Prepare update : android description, sites(osmand/wiki), screenshots, Amerika indexes & poi/transport.index + - // TODO ANDROID - // 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions. - // Some icons are not fine (as back menu from map - it is blured). + // TODO ANDROID + // Prepare update v 0.2.1: android description, sites(osmand/wiki), screenshots, Amerika indexes & poi/transport.index - - // 60. Audio guidance for routing // 61. Provide route information for YOURS (calclate turns/angle/expected time). // Fix some missing turns in CloudMade (for secondary roads wo name). Add them (if dist to prev/next turn > 150m) [dacha] + // 60. Audio guidance for routing // 43. Enable poi filter by name // 58. Upload/Download zip-index from site & unzip them on phone @@ -41,6 +39,7 @@ public class ToDoConstants { // FIXME BUGS Android // 1. Fix bugs with test data (bug with follow turn / left time / add turn) // 2. Improvement : Show stops in the transport route + // 3. Pinch zoom // TODO swing // 9. Fix issues with big files (such as netherlands) - save memory (!) - very slow due to transport index ! @@ -56,6 +55,9 @@ public class ToDoConstants { // Not implemented : show key/transit stops on map, follow mode (show next stop) // 50. Invent opening hours editor in order to edit POI hours better on device // 67. Improve POI search show direction where to go in search & introduce option show near you + // 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions. + // Some icons are not fine (as back menu from map - it is blured). + // DONE SWING diff --git a/DataExtractionOSM/src/com/osmand/data/index/IndexBatchCreator.java b/DataExtractionOSM/src/com/osmand/data/index/IndexBatchCreator.java index f8377c06b9..f4876f33b1 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/IndexBatchCreator.java +++ b/DataExtractionOSM/src/com/osmand/data/index/IndexBatchCreator.java @@ -26,8 +26,8 @@ public class IndexBatchCreator { private static final boolean writeWayNodes = true; protected static final Log log = LogUtil.getLog(IndexBatchCreator.class); - protected static final String SITE_TO_DOWNLOAD = "http://download.geofabrik.de/osm/europe/"; //$NON-NLS-1$ - protected static final String[] countriesToDownload = new String[] { + protected static final String SITE_TO_DOWNLOAD1 = "http://download.geofabrik.de/osm/europe/"; //$NON-NLS-1$ + protected static final String[] countriesToDownload1 = new String[] { "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$ "bulgaria", "croatia", "cyprus", // 13, 12, 5 //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ @@ -54,6 +54,25 @@ public class IndexBatchCreator { }; + protected static final String SITE_TO_DOWNLOAD2 = "http://downloads.cloudmade.com/"; //$NON-NLS-1$ + // us states + protected static final String[] usStates = new String[] { + "Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", + "Delaware", "District_of_Columbia", "Florida", "Georgia", "Guantanamo_Bay", "Hawaii", + "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", + "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", + "Montana", "Nebraska", "Nevada", "New_Hampshire", "New_Jersey", "New_Mexico", + "New_York", "North_Carolina", "North_Dakota", "Ohio", "Oklahoma", "Oregon", + "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", + "Texas", "Utah", "Vermont", "Virginia", "Washington", "West_Virginia", "Wisconsin", "Wyoming", + }; + protected static final String[] canadaStates = new String[] { + "Alberta","British_Columbia","Manitoba","New_Brunswick","Newfoundland", + "Nova_Scotia","Nunavut", "Nw_Territories","Ontario","Pr_Edwrd_Island", + "Quebec","Saskatchewan","Yukon", + }; + + boolean downloadFiles = false; boolean generateIndexes = false; @@ -108,11 +127,25 @@ public class IndexBatchCreator { // log.info("Delete old file " + f.getName()); //$NON-NLS-1$ // f.delete(); // } - for(String country : countriesToDownload){ - String url = SITE_TO_DOWNLOAD + country +".osm.bz2"; //$NON-NLS-1$ + for(String country : countriesToDownload1){ + String url = SITE_TO_DOWNLOAD1 + country +".osm.bz2"; //$NON-NLS-1$ log.info("Downloading country " + country + " from " + url); //$NON-NLS-1$//$NON-NLS-2$ downloadFile(url, new File(osmDirFiles, country +".osm.bz2")); //$NON-NLS-1$ } + + for(String country : usStates){ + country = country.toLowerCase(); + String url = SITE_TO_DOWNLOAD2 + "north_america/united_states/"+country+"/"+country +".osm.bz2"; //$NON-NLS-1$ + log.info("Downloading country " + country + " from " + url); //$NON-NLS-1$//$NON-NLS-2$ + downloadFile(url, new File(osmDirFiles, "US_"+country +".osm.bz2")); //$NON-NLS-1$ + } + + for(String country : canadaStates){ + country = country.toLowerCase(); + String url = SITE_TO_DOWNLOAD2 + "north_america/canada/"+country+"/"+country +".osm.bz2"; //$NON-NLS-1$ + log.info("Downloading country " + country + " from " + url); //$NON-NLS-1$//$NON-NLS-2$ + downloadFile(url, new File(osmDirFiles, "Canada_"+country +".osm.bz2")); //$NON-NLS-1$ + } System.out.println("DOWNLOADING FILES FINISHED"); } @@ -147,7 +180,12 @@ public class IndexBatchCreator { for (File f : getSortedFiles(osmDirFiles)) { if (f.getName().endsWith(".osm.bz2") || f.getName().endsWith(".osm")) { System.gc(); - generateIndex(f); + try { + generateIndex(f); + } catch (OutOfMemoryError e) { + log.error("OutOfMemory", e); + System.gc(); + } } } System.out.println("GENERATING INDEXES FINISHED "); diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 621090c026..3124ac42e0 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -638,7 +638,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat }); msg.what = 7; mapPositionHandler.removeMessages(7); - mapPositionHandler.sendMessageDelayed(msg, 3500); + mapPositionHandler.sendMessageDelayed(msg, 2500); }