diff --git a/src/main/java/geocode/ReverseGeoCode.java b/src/main/java/geocode/ReverseGeoCode.java index 21d8a51..8fe1fab 100644 --- a/src/main/java/geocode/ReverseGeoCode.java +++ b/src/main/java/geocode/ReverseGeoCode.java @@ -30,6 +30,7 @@ of this software and associated documentation files (the "Software"), to deal import java.io.*; import java.util.ArrayList; +import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** @@ -53,7 +54,14 @@ public class ReverseGeoCode { * @throws NullPointerException if zippedPlacenames is {@code null}. */ public ReverseGeoCode( ZipInputStream zippedPlacednames, boolean majorOnly ) throws IOException { - zippedPlacednames.getNextEntry(); + //depending on which zip file is given, + //country specific zip files have read me files + //that we should ignore + ZipEntry entry; + do{ + entry = zippedPlacednames.getNextEntry(); + }while(entry.getName().equals("readme.txt")); + createKdTree(zippedPlacednames, majorOnly); } @@ -79,7 +87,7 @@ private void createKdTree(InputStream placenames, boolean majorOnly) while ((str = in.readLine()) != null) { GeoName newPlace = new GeoName(str); if ( !majorOnly || newPlace.majorPlace ) { - arPlaceNames.add(new GeoName(str)); + arPlaceNames.add(newPlace); } } } catch (IOException ex) {