support binary address index

git-svn-id: https://osmand.googlecode.com/svn/trunk@621 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-11-01 23:42:17 +00:00
parent dda3b6ec80
commit c395d37cb2
9 changed files with 1165 additions and 267 deletions

View file

@ -9,6 +9,7 @@ public class ToDoConstants {
// TODO max 101
// !!! Fix progress in DataExtractionOsm
// Outside base 0.4 release
// 69. Add phone and site information to POI (enable call to POI and open site)

View file

@ -2,9 +2,9 @@ package net.osmand;
public class Version {
public static final String APP_VERSION = "0.4.3"; //$NON-NLS-1$
public static final String APP_VERSION = "0.5.1"; //$NON-NLS-1$
public static final String APP_NAME = "OsmAnd"; //$NON-NLS-1$
public static final String APP_DESCRIPTION = "beta (b2)"; //$NON-NLS-1$
public static final String APP_DESCRIPTION = "beta (b1)"; //$NON-NLS-1$
public static final boolean VELCOM_EDITION = false;
public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION; //$NON-NLS-1$

View file

@ -4,11 +4,15 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Stack;
import net.osmand.Algoritms;
import net.osmand.binary.OsmandOdb.CityIndex;
import net.osmand.binary.OsmandOdb.PostcodeIndex;
import net.osmand.binary.OsmandOdb.StreetIndex;
import net.osmand.binary.OsmandOdb.CityIndex.Builder;
import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.MapObject;
@ -16,6 +20,7 @@ import net.osmand.data.Street;
import net.osmand.data.index.IndexConstants;
import net.osmand.osm.LatLon;
import net.osmand.osm.MapUtils;
import net.sf.junidecode.Junidecode;
import com.google.protobuf.CodedOutputStream;
import com.google.protobuf.WireFormat;
@ -46,8 +51,6 @@ public class BinaryMapIndexWriter {
private Stack<Long> stackBaseIds = new Stack<Long>();
private Stack<Map<String, Integer>> stackStringTable = new Stack<Map<String, Integer>>();
// needed for address index
private MapObject cityOrPostcode = null;
// internal constants to track state of index writing
private Stack<Integer> state = new Stack<Integer>();
@ -61,6 +64,7 @@ public class BinaryMapIndexWriter {
private final static int ADDRESS_INDEX_INIT = 5;
private final static int CITY_INDEX_INIT = 6;
private final static int POSTCODES_INDEX_INIT = 7;
private final static int VILLAGES_INDEX_INIT = 8;
public BinaryMapIndexWriter(final RandomAccessFile raf) throws IOException{
this.raf = raf;
@ -91,7 +95,7 @@ public class BinaryMapIndexWriter {
codedOutStream.writeFixed32NoTag(0);
}
private void writeInt32Size() throws IOException{
private int writeInt32Size() throws IOException{
codedOutStream.flush();
long filePointer = raf.getFilePointer();
Long old = stackSizes.pop();
@ -99,6 +103,7 @@ public class BinaryMapIndexWriter {
raf.seek(old);
raf.writeInt(length);
raf.seek(filePointer);
return length;
}
public void startWriteMapIndex() throws IOException{
@ -110,7 +115,8 @@ public class BinaryMapIndexWriter {
public void endWriteMapIndex() throws IOException{
popState(MAP_INDEX_INIT);
writeInt32Size();
int len = writeInt32Size();
System.out.println("MAP INDEX SIZE : " + len);
}
public void startWriteMapLevelIndex(int minZoom, int maxZoom, int leftX, int rightX, int topY, int bottomY) throws IOException{
@ -330,7 +336,7 @@ public class BinaryMapIndexWriter {
}
public void startWriteAddressIndex(String name) throws IOException {
pushState(OSMAND_STRUCTURE_INIT, ADDRESS_INDEX_INIT);
pushState(ADDRESS_INDEX_INIT, OSMAND_STRUCTURE_INIT);
codedOutStream.writeTag(OsmandOdb.OsmAndStructure.ADDRESSINDEX_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED);
preserveInt32Size();
@ -340,45 +346,104 @@ public class BinaryMapIndexWriter {
public void endWriteAddressIndex() throws IOException {
popState(ADDRESS_INDEX_INIT);
int len = writeInt32Size();
System.out.println("ADDRESS INDEX SIZE : " + len);
}
private boolean checkEnNameToWrite(MapObject obj){
if(obj.getEnName() == null){
return false;
}
return !obj.getEnName().equals(Junidecode.unidecode(obj.getName()));
}
public void writeCityIndex(City city, List<Street> streets) throws IOException {
if(city.getType() == City.CityType.CITY || city.getType() == City.CityType.TOWN){
checkPeekState(CITY_INDEX_INIT);
} else {
checkPeekState(VILLAGES_INDEX_INIT);
}
CityIndex.Builder cityInd = OsmandOdb.CityIndex.newBuilder();
cityInd.setCityType(city.getType().ordinal());
cityInd.setId(city.getId());
cityInd.setName(city.getName());
if(checkEnNameToWrite(city)){
cityInd.setNameEn(city.getEnName());
}
cityInd.setX(MapUtils.get31TileNumberX(city.getLocation().getLongitude()));
cityInd.setY(MapUtils.get31TileNumberY(city.getLocation().getLatitude()));
for(Street s : streets){
StreetIndex streetInd = createStreetAndBuildings(s, city.getLocation(), null);
cityInd.addStreets(streetInd);
}
codedOutStream.writeMessage(OsmandOdb.CitiesIndex.CITIES_FIELD_NUMBER, cityInd.build());
}
public void startCityIndexes(boolean villages) throws IOException {
pushState(villages ? VILLAGES_INDEX_INIT : CITY_INDEX_INIT, ADDRESS_INDEX_INIT);
codedOutStream.writeTag(villages ? OsmandOdb.OsmAndAddressIndex.VILLAGES_FIELD_NUMBER
: OsmandOdb.OsmAndAddressIndex.CITIES_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED);
preserveInt32Size();
}
public void endCityIndexes(boolean villages) throws IOException {
popState(villages ? VILLAGES_INDEX_INIT : CITY_INDEX_INIT);
writeInt32Size();
}
public void startWriteCityIndex(City city) throws IOException {
pushState(CITY_INDEX_INIT, ADDRESS_INDEX_INIT);
codedOutStream.writeTag(OsmandOdb.OsmAndStructure.ADDRESSINDEX_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED);
public void startPostcodes() throws IOException {
pushState(POSTCODES_INDEX_INIT, ADDRESS_INDEX_INIT);
codedOutStream.writeTag(OsmandOdb.OsmAndAddressIndex.POSTCODES_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED);
preserveInt32Size();
codedOutStream.writeUInt32(OsmandOdb.CityIndex.CITY_TYPE_FIELD_NUMBER, city.getType().ordinal());
codedOutStream.writeUInt64(OsmandOdb.CityIndex.ID_FIELD_NUMBER, city.getId());
codedOutStream.writeString(OsmandOdb.CityIndex.NAME_FIELD_NUMBER, city.getName());
if(city.getEnName() != null){
codedOutStream.writeString(OsmandOdb.CityIndex.NAME_EN_FIELD_NUMBER, city.getEnName());
}
codedOutStream.writeFixed32(OsmandOdb.CityIndex.X_FIELD_NUMBER, MapUtils.get31TileNumberX(city.getLocation().getLongitude()));
codedOutStream.writeFixed32(OsmandOdb.CityIndex.Y_FIELD_NUMBER, MapUtils.get31TileNumberY(city.getLocation().getLatitude()));
cityOrPostcode = city;
}
public void writeStreetAndBuildings(Street street) throws IOException {
public void endPostcodes() throws IOException {
popState(POSTCODES_INDEX_INIT);
writeInt32Size();
}
public void writePostcode(String postcode, List<Street> streets) throws IOException {
checkPeekState(POSTCODES_INDEX_INIT);
LatLon loc = streets.get(0).getLocation();
PostcodeIndex.Builder post = OsmandOdb.PostcodeIndex.newBuilder();
post.setPostcode(postcode);
for(Street s : streets){
StreetIndex streetInd = createStreetAndBuildings(s, loc, postcode);
post.addStreets(streetInd);
}
codedOutStream.writeMessage(OsmandOdb.PostcodesIndex.POSTCODES_FIELD_NUMBER, post.build());
}
protected StreetIndex createStreetAndBuildings(Street street, LatLon l, String postcodeFilter) throws IOException {
checkPeekState(CITY_INDEX_INIT, POSTCODES_INDEX_INIT);
boolean inCity = state.peek() == CITY_INDEX_INIT;
StreetIndex.Builder streetBuilder = OsmandOdb.StreetIndex.newBuilder();
streetBuilder.setName(street.getName());
if(street.getEnName() != null){
if(checkEnNameToWrite(street)){
streetBuilder.setNameEn(street.getEnName());
}
streetBuilder.setId(street.getId());
LatLon location = cityOrPostcode.getLocation();
int cx = MapUtils.get31TileNumberX(location.getLongitude());
int cy = MapUtils.get31TileNumberY(location.getLatitude());
int cx = MapUtils.get31TileNumberX(l.getLongitude());
int cy = MapUtils.get31TileNumberY(l.getLatitude());
int sx = MapUtils.get31TileNumberX(street.getLocation().getLongitude());
int sy = MapUtils.get31TileNumberY(street.getLocation().getLatitude());
streetBuilder.setX((sx - cx) >> 7);
streetBuilder.setY((sy - cy) >> 7);
for(Building b : street.getBuildings()){
if(postcodeFilter != null && !postcodeFilter.equalsIgnoreCase(b.getPostcode())){
continue;
}
OsmandOdb.BuildingIndex.Builder bbuilder= OsmandOdb.BuildingIndex.newBuilder();
int bx = MapUtils.get31TileNumberX(b.getLocation().getLongitude());
int by = MapUtils.get31TileNumberY(b.getLocation().getLatitude());
@ -386,28 +451,18 @@ public class BinaryMapIndexWriter {
bbuilder.setY((by - sy) >> 7);
bbuilder.setId(b.getId());
bbuilder.setName(b.getName());
if(b.getEnName() != null){
if(checkEnNameToWrite(b)){
bbuilder.setNameEn(b.getEnName());
}
if(inCity && b.getPostcode() != null){
bbuilder.setPostcode(b.getPostcode());
}
streetBuilder.addBuildings(bbuilder.build());
}
if(state.peek() == CITY_INDEX_INIT){
codedOutStream.writeMessage(OsmandOdb.CityIndex.STREETS_FIELD_NUMBER, streetBuilder.build());
} else {
throw new UnsupportedOperationException();
}
return streetBuilder.build();
}
public void endWriteCityIndex() throws IOException {
popState(CITY_INDEX_INIT);
writeInt32Size();
cityOrPostcode = null;
}
private void pushState(int push, int peek){
if(state.peek() != peek){

File diff suppressed because it is too large Load diff

View file

@ -3,11 +3,14 @@ package net.osmand.data.index;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import net.osmand.LogUtil;
import net.osmand.data.Building;
@ -54,11 +57,49 @@ public class DataIndexReader {
return cities;
}
public List<Street> readStreets(Connection c, City city) throws SQLException{
List<Street> streets = new ArrayList<Street>();
Statement stat = c.createStatement();
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexStreetTable.values(),
IndexStreetTable.CITY.toString() +" = " + city.getId())); //$NON-NLS-1$
public PreparedStatement getStreetsPreparedStatement(Connection c) throws SQLException{
return c.prepareStatement(IndexConstants.generateSelectSQL(IndexStreetTable.values(),
IndexStreetTable.CITY.toString() +" = ? ")); //$NON-NLS-1$
}
public PreparedStatement getStreetsBuildingPreparedStatement(Connection c) throws SQLException{
return c.prepareStatement("SELECT A.id, A.name, A.name_en, A.latitude, A.longitude, "+
"B.id, B.name, B.name_en, B.latitude, B.longitude, B.postcode "+
"FROM street A INNER JOIN building B ON B.street = A.id WHERE A.city = ? "); //$NON-NLS-1$
}
public List<Street> readStreetsBuildings(PreparedStatement streetBuildingsStat, City city, List<Street> streets) throws SQLException{
Map<Long, Street> visitedStreets = new LinkedHashMap<Long, Street>();
streetBuildingsStat.setLong(1, city.getId());
ResultSet set = streetBuildingsStat.executeQuery();
while(set.next()){
long streetId = set.getLong(1);
if(!visitedStreets.containsKey(streetId)){
Street street = new Street(null);
street.setName(set.getString(2));
street.setEnName(set.getString(3));
street.setLocation(set.getDouble(4),set.getDouble(5));
street.setId(streetId);
streets.add(street);
visitedStreets.put(streetId, street);
}
Street s = visitedStreets.get(streetId);
Building b = new Building();
b.setId(set.getLong(6));
b.setName(set.getString(7));
b.setEnName(set.getString(8));
b.setLocation(set.getDouble(9),set.getDouble(10));
b.setPostcode(set.getString(11));
s.registerBuilding(b);
}
set.close();
return streets;
}
public List<Street> readStreets(PreparedStatement streetsStat, City city, List<Street> streets) throws SQLException{
streetsStat.setLong(1, city.getId());
ResultSet set = streetsStat.executeQuery();
while(set.next()){
Street street = new Street(city);
street.setName(set.getString(IndexStreetTable.NAME.ordinal() + 1));
@ -69,15 +110,18 @@ public class DataIndexReader {
streets.add(street);
}
set.close();
stat.close();
return streets;
}
public List<Building> readBuildings(Connection c, Street street) throws SQLException{
List<Building> buildings = new ArrayList<Building>();
Statement stat = c.createStatement();
ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexBuildingTable.values(),
IndexBuildingTable.STREET.toString() +" = " + street.getId())); //$NON-NLS-1$
public PreparedStatement getBuildingsPreparedStatement(Connection c) throws SQLException{
return c.prepareStatement(IndexConstants.generateSelectSQL(IndexBuildingTable.values(),
IndexBuildingTable.STREET.toString() +" = ? "));
}
public List<Building> readBuildings(PreparedStatement buildingStat, Street street, List<Building> buildings) throws SQLException{
buildingStat.setLong(1, street.getId());
ResultSet set = buildingStat.executeQuery();
while(set.next()){
Building building = new Building();
building.setName(set.getString(IndexBuildingTable.NAME.ordinal() + 1));
@ -88,23 +132,45 @@ public class DataIndexReader {
buildings.add(building);
}
set.close();
stat.close();
return buildings;
}
public void testIndex(File f) throws SQLException {
Connection c = getConnection(f);
try {
for (City city : readCities(c)) {
System.out.println("CITY " + city.getName()); //$NON-NLS-1$
for (Street s : readStreets(c, city)) {
System.out.println("\tSTREET " + s.getName()); //$NON-NLS-1$
for (Building b : readBuildings(c, s)) {
System.out.println("\t\tBULDING " + b.getName()); //$NON-NLS-1$
ArrayList<Street> streets = new ArrayList<Street>();
ArrayList<Building> buildings = new ArrayList<Building>();
PreparedStatement streetstat = getStreetsBuildingPreparedStatement(c);
int countCity = 0;
int countStreets = 0;
int countBuildings = 0;
List<City> cities = readCities(c);
for (City city : cities) {
countCity ++;
// System.out.println("CITY " + city.getName()); //$NON-NLS-1$
if(city.getType() != CityType.CITY){
continue;
}
streets.clear();
long time = System.currentTimeMillis();
readStreetsBuildings(streetstat, city, streets);
if(!streets.isEmpty()){
System.out.println(city.getName());
} else {
System.out.print(".");
}
for (Street s : streets) {
countStreets ++;
// System.out.println("\tSTREET " + s.getName()); //$NON-NLS-1$
// buildings.clear();
for (Building b : s.getBuildings()) {
countBuildings ++;
// System.out.println("\t\tBULDING " + b.getName()); //$NON-NLS-1$
}
}
}
System.out.println(countCity + " " + countStreets + " " + countBuildings);
} finally {
c.close();
}

View file

@ -285,6 +285,7 @@ public class IndexBatchCreator {
String addressFileName = regionName + "_" + IndexConstants.ADDRESS_TABLE_VERSION + IndexConstants.ADDRESS_INDEX_EXT;
indexCreator.setAddressFileName(addressFileName);
indexCreator.setSupportOdbAddressFile(true);
String transportFileName = regionName + "_" + IndexConstants.TRANSPORT_TABLE_VERSION + IndexConstants.TRANSPORT_INDEX_EXT;
indexCreator.setTransportFileName(transportFileName);
String poiFileName = regionName + "_" + IndexConstants.POI_TABLE_VERSION + IndexConstants.POI_INDEX_EXT;

View file

@ -13,6 +13,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -23,6 +24,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
import java.util.Map.Entry;
import net.osmand.Algoritms;
@ -33,9 +35,11 @@ import net.osmand.data.Building;
import net.osmand.data.City;
import net.osmand.data.DataTileManager;
import net.osmand.data.MapObject;
import net.osmand.data.Street;
import net.osmand.data.TransportRoute;
import net.osmand.data.TransportStop;
import net.osmand.data.City.CityType;
import net.osmand.data.index.DataIndexReader;
import net.osmand.data.index.DataIndexWriter;
import net.osmand.data.index.IndexConstants;
import net.osmand.data.index.IndexConstants.IndexBinaryMapRenderObject;
@ -105,6 +109,7 @@ public class IndexCreator {
private boolean indexTransport;
private boolean indexAddress;
private boolean supportOdbAddressFile;
private boolean normalizeStreets;
private boolean saveAddressWays;
@ -203,6 +208,10 @@ public class IndexCreator {
this.indexAddress = indexAddress;
}
public void setSupportOdbAddressFile(boolean supportOdbAddressFile) {
this.supportOdbAddressFile = supportOdbAddressFile;
}
public void setIndexMap(boolean indexMap) {
this.indexMap = indexMap;
}
@ -1484,10 +1493,68 @@ public class IndexCreator {
}
public void writeBinaryAddressIndex(BinaryMapIndexWriter writer) throws IOException, SQLException {
writer.startWriteAddressIndex(getRegionName());
DataIndexReader reader = new DataIndexReader();
List<City> cities = reader.readCities(addressConnection);
List<Street> streets = new ArrayList<Street>();
Collections.sort(cities, new Comparator<City>(){
@Override
public int compare(City o1, City o2) {
if (o1.getType() != o2.getType()) {
return -(o1.getType().ordinal() - o2.getType().ordinal());
}
return Collator.getInstance().compare(o1.getName(), o2.getName());
}
});
PreparedStatement streetstat = reader.getStreetsBuildingPreparedStatement(addressConnection);
Map<String, List<Street>> postcodes = new TreeMap<String, List<Street>>();
boolean writeCities = true;
// write cities and after villages
writer.startCityIndexes(false);
for(int i =0; i< cities.size(); i++ ) {
City c = cities.get(i);
if(writeCities && c.getType() != CityType.CITY && c.getType() != CityType.TOWN){
writer.endCityIndexes(false);
writer.startCityIndexes(true);
writeCities = false;
}
streets.clear();
reader.readStreetsBuildings(streetstat, c, streets);
writer.writeCityIndex(c, streets);
for(Street s : streets){
for(Building b : s.getBuildings()){
if(b.getPostcode() != null){
if(!postcodes.containsKey(b.getPostcode())){
postcodes.put(b.getPostcode(), new ArrayList<Street>(3));
}
postcodes.get(b.getPostcode()).add(s);
}
}
}
}
writer.endCityIndexes(!writeCities);
// write postcodes
writer.startPostcodes();
for(String s : postcodes.keySet()){
writer.writePostcode(s, postcodes.get(s));
}
writer.endPostcodes();
writer.endWriteAddressIndex();
}
public void writeBinaryMapIndex(BinaryMapIndexWriter writer) throws IOException, SQLException {
try {
assert IndexConstants.IndexBinaryMapRenderObject.values().length == 6;
@ -1863,6 +1930,11 @@ public class IndexCreator {
DataIndexWriter.addBatch(pStatements, pstat, BATCH_SIZE);
}
}
if(pStatements.get(pstat) > 0){
pstat.executeBatch();
}
pStatements.remove(pstat);
}
@ -1901,17 +1973,24 @@ public class IndexCreator {
log.info("Finish packing RTree files");
}
if(indexMap || indexAddress){
if(indexMap || (indexAddress && !supportOdbAddressFile)){
if(mapFile.exists()){
mapFile.delete();
}
mapRAFile = new RandomAccessFile(mapFile, "rw");
BinaryMapIndexWriter writer = new BinaryMapIndexWriter(mapRAFile);
if(indexMap){
log.info("Writing binary map data...");
writeBinaryMapIndex(writer);
}
if(indexAddress){
if(indexAddress && !supportOdbAddressFile){
log.info("Writing binary address data...");
closePreparedStatements(addressCityStat, addressStreetStat, addressStreetNodeStat, addressBuildingStat);
addressConnection.commit();
writeBinaryAddressIndex(writer);
addressConnection.close();
addressConnection = null;
}
log.info("Finish writing binary file");
}
@ -1999,10 +2078,20 @@ public class IndexCreator {
}
dbConn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
protected void closePreparedStatements(PreparedStatement... preparedStatements) throws SQLException{
for(PreparedStatement p : preparedStatements){
p.executeBatch();
p.close();
pStatements.remove(p);
}
}
public static void removeWayNodes(File sqlitedb) throws SQLException{
Connection dbConn = DriverManager.getConnection("jdbc:sqlite:" + sqlitedb.getAbsolutePath());
dbConn.setAutoCommit(false);
@ -2018,25 +2107,22 @@ public class IndexCreator {
}
public static void main(String[] args) throws IOException, SAXException, SQLException {
long time = System.currentTimeMillis();
IndexCreator creator = new IndexCreator(new File("e:/Information/OSM maps/osmand/"));
creator.setIndexMap(true);
creator.setIndexAddress(true);
// creator.setIndexPOI(true);
// creator.setIndexTransport(true);
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/minsk.tmp.odb"));
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/minsk.osm"), new ConsoleProgressImplementation(3), null);
creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/minsk.tmp.odb"));
creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/minsk.osm"), new ConsoleProgressImplementation(3), null);
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/belarus_nodes.tmp.odb"));
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/belarus.osm.bz2"), new ConsoleProgressImplementation(3), null);
//
// creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/forest.osm"), new ConsoleProgressImplementation(3), null);
// double dist = MapUtils.getDistance(50, MapUtils.getLongitudeFromTile(25, 0), 50, MapUtils.getLongitudeFromTile(25, 1));
// System.out.println(dist);
// System.out.println(-5 << 2);
// creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/ams.tmp.odb"));
@ -2050,7 +2136,8 @@ public class IndexCreator {
// creator.generateIndexes(new File("e:/Information/OSM maps/osm_map/forest_complex.osm"), new ConsoleProgressImplementation(25), null);
new DataIndexReader().testIndex(new File("e:\\Information\\OSM maps\\osmand\\Address\\Belarus.addr.odb"));
System.out.println(System.currentTimeMillis() - time);
System.out.println("COORDINATES_SIZE " + BinaryMapIndexWriter.COORDINATES_SIZE + " count " + BinaryMapIndexWriter.COORDINATES_COUNT);
System.out.println("TYPES_SIZE " + BinaryMapIndexWriter.TYPES_SIZE);
System.out.println("ID_SIZE " + BinaryMapIndexWriter.ID_SIZE);

View file

@ -82,11 +82,23 @@ message OsmAndAddressIndex {
optional string name_en = 2;
// encoded as fixed32 length delimited
repeated CityIndex cityIndex= 5; // cities and towns
optional CitiesIndex cities = 5; // cities and towns
repeated PostcodeIndex postcodes= 6;
// encoded as fixed32 length delimited
optional PostcodesIndex postcodes = 6;
repeated CityIndex villages = 7; // suburbs and villages
// encoded as fixed32 length delimited
optional CitiesIndex villages = 7; // suburbs and villages
}
message CitiesIndex {
// encoded as fixed32 length delimited
repeated CityIndex cities = 1;
}
message PostcodesIndex {
// encoded as fixed32 length delimited
repeated PostcodeIndex postcodes = 1;
}
message CityIndex {
@ -101,6 +113,8 @@ message CityIndex {
repeated StreetIndex streets = 7;
}
message PostcodeIndex {
required string postcode = 1;
repeated StreetIndex streets = 5;
@ -122,6 +136,7 @@ message BuildingIndex {
required string name = 1;
optional string name_en = 2;
optional uint64 id = 5;
optional string postcode = 6;
required sint32 x = 3; // delta encoded to street 24 zoom
required sint32 y = 4; // delta encoded to street 24 zoom

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.osmand" android:versionName="0.4.3" android:versionCode="19" android:installLocation="auto">
package="net.osmand" android:versionName="0.5.1" android:versionCode="20" android:installLocation="auto">
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true" android:name=".activities.OsmandApplication" android:description="@string/app_description">
<activity android:name=".activities.MainMenuActivity"