OsmAnd/DataExtractionOSM/src/osmand_odb.proto

588 lines
16 KiB
Protocol Buffer
Raw Normal View History

2012-06-06 23:37:21 +02:00
// Highly coupled with protobuf 2.3.0
2011-05-07 22:56:11 +02:00
option java_package = "net.osmand.binary";
2011-11-04 01:03:37 +01:00
//protoc --java_out=DataExtractionOSM/src DataExtractionOSM/src/osmand_odb.proto
2011-05-07 22:56:11 +02:00
2011-10-28 16:01:00 +02:00
// C++ # cd OsmAnd
// # protoc --proto_path=../DataExtractionOSM/src --cpp_out=../Osmand-kernel/osmand/src/proto/ ../DataExtractionOSM/src/osmand_odb.proto
2011-10-28 16:01:00 +02:00
2011-05-07 22:56:11 +02:00
//
// STORAGE LAYER: Storing primitives.
//
2011-11-04 01:03:37 +01:00
// IMPORTANT : These messages are not intented to be parsed by google engine (because of the random access to the file)
// The main difference that size of that messages is not var int and is always fixed int size
2011-05-07 22:56:11 +02:00
message OsmAndStructure {
required uint32 version = 1;
2011-10-11 00:27:18 +02:00
2012-02-15 21:59:59 +01:00
// System.currentTimeMillis()
required int64 dateCreated = 18;
2011-10-11 00:27:18 +02:00
// first version of map index was 3.
2011-05-07 22:56:11 +02:00
// encoded as fixed32 length delimited
2011-10-11 00:27:18 +02:00
repeated OsmAndAddressIndex addressIndex = 7;
2011-05-07 22:56:11 +02:00
// encoded as fixed32 length delimited
repeated OsmAndTransportIndex transportIndex = 4;
2011-10-11 00:27:18 +02:00
2011-11-05 15:39:00 +01:00
// slight changes previous version was 5
// encoded as fixed32 length delimited
repeated OsmAndPoiIndex poiIndex = 8;
2011-05-07 22:56:11 +02:00
2011-10-11 00:27:18 +02:00
// first version of map index was 2.
// encoded as fixed32 length delimited
repeated OsmAndMapIndex mapIndex = 6;
2012-05-15 20:48:06 +02:00
// encoded as fixed32 length delimited
repeated OsmAndRoutingIndex routingIndex = 9;
2011-05-07 22:56:11 +02:00
// last field should version again (to check consistency)
required uint32 versionConfirm = 32;
}
2011-10-14 01:23:39 +02:00
message OsmAndTileBox {
// everything is encoded as 31 tile zoom
required uint32 left = 1;
required uint32 right = 2;
required uint32 top = 3;
required uint32 bottom = 4;
}
2011-05-07 22:56:11 +02:00
/**
String table, contains the common strings in each block.
*/
message StringTable {
repeated string s = 1;
2011-09-22 01:06:09 +02:00
}
2011-05-07 22:56:11 +02:00
2011-09-27 01:22:07 +02:00
message IndexedStringTable {
// common prefix for all strings inside
optional string prefix = 1;
// key, val and subtables are mixed and order is preserved by key (ascending)
// so that's example of data : key1,val1,subtables1,key2,val2,key3,val3,subtables3,subtables3
repeated string key = 3;
// the shift to the data or one uint data itself
2012-02-25 14:51:29 +01:00
repeated fixed32 val = 4;
2011-09-27 01:22:07 +02:00
// subtables are supposed to make search faster instead of searching through all strings
2012-02-25 14:51:29 +01:00
// it's enough to read prefix in the header
2011-09-27 01:22:07 +02:00
repeated IndexedStringTable subtables = 5;
}
2011-11-04 01:03:37 +01:00
///////////////////////
//// Map messages ////
///////////////////////
2011-05-07 22:56:11 +02:00
message OsmAndMapIndex {
2011-11-04 01:03:37 +01:00
required string name = 2;
2011-05-07 22:56:11 +02:00
2011-11-04 01:03:37 +01:00
repeated MapEncodingRule rules = 4;
message MapEncodingRule {
required string tag = 3;
optional string value = 5;
// it is optional because natural order in block of rules
2012-02-16 00:21:07 +01:00
// is the same as id (id is 1-based and order)
2011-11-04 01:03:37 +01:00
optional uint32 id = 7;
2012-02-16 00:21:07 +01:00
// min zoom combination exists
2011-11-04 01:03:37 +01:00
optional uint32 minZoom = 9;
2012-02-16 00:21:07 +01:00
// "additional" flag is encoded as %2 == 1
2011-11-07 01:18:20 +01:00
optional uint32 type = 10;
2011-11-04 01:03:37 +01:00
}
2012-02-18 23:42:28 +01:00
// encoded as fixed32 length delimited
2011-11-04 01:03:37 +01:00
repeated MapRootLevel levels = 5;
message MapRootLevel {
required int32 maxZoom = 1;
required int32 minZoom = 2;
required int32 left = 3;
required int32 right = 4;
required int32 top = 5;
required int32 bottom = 6;
repeated MapDataBox boxes = 7;
2012-03-15 00:49:34 +01:00
2012-03-18 22:08:47 +01:00
repeated MapDataBlock blocks = 15;
2011-11-04 01:03:37 +01:00
}
message MapDataBox {
required sint32 left = 1; // delta encoded
required sint32 right = 2; // delta encoded
required sint32 top = 3; // delta encoded
required sint32 bottom = 4; // delta encoded
2012-02-16 00:21:07 +01:00
//shift from mapdatabox start to message MapDataBlock
optional fixed32 shiftToMapData = 5;
2012-04-02 21:50:45 +02:00
// true (byte = 1) - full ocean, false (byte = 0) - full land
2012-02-19 02:21:43 +01:00
optional bool ocean = 6;
2011-11-04 01:03:37 +01:00
repeated MapDataBox boxes = 7;
}
2011-05-07 22:56:11 +02:00
}
2011-11-04 01:03:37 +01:00
message MapDataBlock {
// coordinates can take much space 4*4*count of data blocks=
// required sint32 left = 1; // delta encoded
// required sint32 right = 2; // delta encoded
// required sint32 top = 3; // delta encoded
// required sint32 bottom = 4; // delta encoded
2011-05-07 22:56:11 +02:00
optional uint64 baseId = 10;
2011-11-04 01:03:37 +01:00
// in future here can be optional raster tile
repeated MapData dataObjects = 12;
optional StringTable stringTable = 15;
2012-03-05 00:55:51 +01:00
2011-05-07 22:56:11 +02:00
}
message MapData {
2011-11-04 01:03:37 +01:00
// array of delta x,y sint32 (CodedIinputStream) >> 5
// first x delta to Tree.left, y to delta Tree.top (next delta to previous)
2012-02-19 02:21:43 +01:00
// point, line or outer polygon coordinates
optional bytes coordinates = 1;
optional bytes areaCoordinates = 2;
2011-11-04 01:03:37 +01:00
repeated bytes polygonInnerCoordinates = 4;
2011-11-07 01:18:20 +01:00
// array of raw var int types
optional bytes additionalTypes = 6;
2011-11-04 01:03:37 +01:00
// array of raw var int types
required bytes types = 7;
2011-11-07 01:18:20 +01:00
2011-11-04 01:03:37 +01:00
// repeated array<pair<tagId : raw_var_int, indexOfStringInParent : raw_var_int> >
2012-03-18 22:08:47 +01:00
optional bytes stringNames = 10; // in parent block
2011-11-04 01:03:37 +01:00
required sint64 id = 12; // delta encoded
2012-03-18 22:08:47 +01:00
optional bytes rasterBytes = 15;
2011-05-07 22:56:11 +02:00
}
2011-11-04 01:03:37 +01:00
////////////////////////////
///// Address messages ////
////////////////////////////
2011-05-07 22:56:11 +02:00
message OsmAndAddressIndex {
required string name = 1;
optional string name_en = 2;
2011-10-14 01:23:39 +02:00
optional OsmAndTileBox boundaries = 3;
2011-05-07 22:56:11 +02:00
// encoded as fixed32 length delimited
2011-10-11 00:27:18 +02:00
// 1) cities and towns - type 1, 2) postcodes - type 2, 3) villages - type 3
2011-10-14 01:23:39 +02:00
repeated CitiesIndex cities = 6;
2011-11-04 01:03:37 +01:00
message CitiesIndex {
// cities and towns - type 1, postcodes - type 2, villages - type 3
required uint32 type = 2;
// not mixed
// the list of the cities and the blocks are synchronized by the order (so even empty block will be written)
repeated CityIndex cities = 5;
repeated CityBlockIndex blocks = 7;
}
2011-10-14 01:23:39 +02:00
// encoded as fixed32 length delimited
optional OsmAndAddressNameIndexData nameIndex = 7;
2011-05-07 22:56:11 +02:00
}
2011-10-11 00:27:18 +02:00
message OsmAndAddressNameIndexData {
2011-11-04 01:03:37 +01:00
// shift to AddressNameIndexData starting from first OsmAndAddressNameIndexData message
2011-10-11 00:27:18 +02:00
// encoded as fixed32 length delimited
required IndexedStringTable table = 4;
2012-02-25 14:51:29 +01:00
repeated AddressNameIndexData atom = 7;
message AddressNameIndexData {
2012-03-04 23:23:24 +01:00
// shift is measured from start (before length)
2012-02-25 14:51:29 +01:00
repeated AddressNameIndexDataAtom atom = 4;
}
2011-05-07 22:56:11 +02:00
}
2011-11-04 01:03:37 +01:00
2011-10-11 00:27:18 +02:00
message AddressNameIndexDataAtom {
2012-03-17 13:17:31 +01:00
optional string name = 1;
2011-10-11 00:27:18 +02:00
optional string nameEn = 2;
// 1 - city, 2 - postcode, 3 - village, 4 - street
required uint32 type = 3;
2011-10-14 01:23:39 +02:00
// mixed
2012-03-04 23:23:24 +01:00
// shift from start AddressNameIndexData (!) to ...Index
2012-03-17 13:17:31 +01:00
repeated int32 shiftToIndex = 5;
2011-10-11 00:27:18 +02:00
// optional used in case of type=street
2012-03-17 13:17:31 +01:00
repeated int32 shiftToCityIndex = 6;
2011-10-11 00:27:18 +02:00
}
2011-05-07 22:56:11 +02:00
message CityIndex {
2011-10-11 00:27:18 +02:00
// should be written the first (for city), for postcode is optional
optional uint32 city_type = 1; // 0-5 enum CityType
2011-05-07 22:56:11 +02:00
required string name = 2;
optional string name_en = 3;
optional uint64 id = 4;
2012-03-15 23:25:48 +01:00
required uint32 x = 5; // x tile of 31 zoom
required uint32 y = 6; // y tile of 31 zoom
2011-05-07 22:56:11 +02:00
2012-03-04 19:23:39 +01:00
// shift from start CityIndex (without length) to cityBlockIndex
2011-10-11 00:27:18 +02:00
optional fixed32 shiftToCityBlockIndex = 10;
2011-05-07 22:56:11 +02:00
}
2011-10-11 00:27:18 +02:00
message CityBlockIndex {
2011-05-07 22:56:11 +02:00
2011-10-14 01:23:39 +02:00
// shift from start cityBlockIndex to CityIndex
optional fixed32 shiftToCityIndex = 4;
2011-10-11 00:27:18 +02:00
// buildings that doesn't belong to the street
2012-03-17 13:17:31 +01:00
repeated BuildingIndex buildings = 10;
2011-10-11 00:27:18 +02:00
2012-03-17 13:17:31 +01:00
repeated StreetIndex streets = 12;
2011-05-07 22:56:11 +02:00
}
message StreetIndex {
required string name = 1;
optional string name_en = 2;
required sint32 x = 3; // delta encoded to parent 24 zoom
required sint32 y = 4; // delta encoded to parent 24 zoom
optional uint64 id = 6;
2011-10-11 00:27:18 +02:00
repeated BuildingIndex buildings = 12;
repeated StreetIntersection intersections = 5;
}
message StreetIntersection {
required string name = 2;
optional string name_en = 3;
2011-05-07 22:56:11 +02:00
2011-10-11 00:27:18 +02:00
required sint32 intersectedX = 4; // delta encoded to parent street x 24 zoom
required sint32 intersectedY = 5; // delta encoded to parent street y 24 zoom
2011-05-07 22:56:11 +02:00
}
message BuildingIndex {
required string name = 1;
optional string name_en = 2;
2011-10-11 00:27:18 +02:00
// used for interpolation
optional string name2 = 3;
optional string name_en2 = 4;
// special values 0 means - nothing, -1 - all, -2 - even, -3 - odd, -4, alphabetic
// positive - just positive interpolation
optional sint32 interpolation = 5;
required sint32 x = 7; // delta encoded to parent 24 zoom
required sint32 y = 8; // delta encoded to parent 24 zoom
// used for interpolation
optional sint32 x2 = 9; // delta encoded to parent 24 zoom
optional sint32 y2 = 10; // delta encoded to parent 24 zoom
2011-05-07 22:56:11 +02:00
2011-10-11 00:27:18 +02:00
optional uint64 id = 13;
optional string postcode = 14;
2011-05-07 22:56:11 +02:00
}
2011-11-04 01:03:37 +01:00
////////////////////////////
//// Transport messages ////
////////////////////////////
2011-05-07 22:56:11 +02:00
message TransportRoutes {
repeated TransportRoute routes = 6;
}
message TransportRoute {
required uint64 id = 1;
optional uint32 type = 3; // reference in string table
optional uint32 operator = 4; // reference in string table
optional string ref = 5;
optional uint32 name = 6; // reference in string table
optional uint32 name_en = 7; // reference in string table
optional uint32 distance = 8; // distance in meters
repeated TransportRouteStop directStops = 15;
repeated TransportRouteStop reverseStops = 16;
}
message TransportRouteStop {
required sint64 id = 1; // delta encoded to previous stop (first stop is delta to 0)
required sint32 dx = 2; // delta encoded to previous stop (24 zoom)
required sint32 dy = 3; // delta encoded to previous stop (24 zoom)
required uint32 name = 6; // index in message table
optional uint32 name_en = 7; // index in message table
}
message TransportStop {
required sint32 dx = 1; // delta encoded to parent (24 zoom) to left
required sint32 dy = 2; // delta encoded to parent (24 zoom) to top
required sint64 id = 5; // delta encoded to parent base id
required uint32 name = 6; // index in message table
optional uint32 name_en = 7; // index in message table
repeated uint32 routes = 16; // -shift to transport route containing that stop
// TransportStop.Message.start - sizeof(TransportStop.Message.length) - routes[i]
// = TransportRoute.Message.start - sizeof(TransportRoute.Message.length)
// message is started when body is started
}
message TransportStopsTree {
required sint32 left = 1; // delta encoded (24 zoom)
required sint32 right = 2; // delta encoded (24 zoom)
required sint32 top = 3; // delta encoded (24 zoom)
required sint32 bottom = 4; // delta encoded (24 zoom)
// encoded as fixed32 length delimited
repeated TransportStopsTree subtrees = 7;
repeated TransportStop leafs = 8;
// written as last
optional uint64 baseId = 16;
}
message OsmAndTransportIndex {
optional string name = 1;
// encoded as fixed32 length delimited
optional TransportRoutes routes = 3; // routes
// encoded as fixed32 length delimited
optional TransportStopsTree stops = 6;
required StringTable stringTable = 9;
2011-09-22 23:22:04 +02:00
}
2011-09-21 00:10:23 +02:00
message OsmAndPoiIndex {
required string name = 1;
2011-09-22 23:22:04 +02:00
required OsmAndTileBox boundaries = 2;
2011-09-21 00:50:51 +02:00
repeated OsmAndCategoryTable categoriesTable = 3;
2011-09-21 00:10:23 +02:00
2011-09-27 01:22:07 +02:00
// encoded as fixed32 length delimited
optional OsmAndPoiNameIndex nameIndex = 4;
2011-09-21 00:10:23 +02:00
// encoded as fixed32 length delimited
2011-09-21 00:50:51 +02:00
repeated OsmAndPoiBox boxes = 6; // children
2011-09-21 00:10:23 +02:00
// encoded as fixed32 length delimited
2011-09-22 01:06:09 +02:00
repeated OsmAndPoiBoxData poiData = 9;
2011-09-21 00:10:23 +02:00
}
2011-09-27 01:22:07 +02:00
message OsmAndPoiNameIndex {
2012-02-25 14:51:29 +01:00
// shift to OsmAndPoiNameIndexData starting from OsmAndPoiIndex message
// encoded as fixed32 length delimited
required IndexedStringTable table = 3;
repeated OsmAndPoiNameIndexData data = 5;
2011-11-05 15:39:00 +01:00
message OsmAndPoiNameIndexData {
// can contain multiple data offsets
repeated OsmAndPoiNameIndexDataAtom atoms = 3;
}
2011-09-27 01:22:07 +02:00
}
message OsmAndPoiNameIndexDataAtom {
// fields do not preserve order define, they are repeating
optional uint32 zoom = 2;
optional uint32 x = 3;
optional uint32 y = 4;
2012-02-25 14:51:29 +01:00
// shift to OsmAndPoiBoxData message from OsmAndPoiNameIndexDataAtom.start
2011-09-27 01:22:07 +02:00
// message is started when body is started
optional fixed32 shiftTo = 14;
}
2011-09-21 00:50:51 +02:00
2011-09-22 01:06:09 +02:00
message OsmAndCategoryTable {
2011-09-21 00:50:51 +02:00
required string category = 1;
repeated string subcategories = 3;
}
2011-09-21 00:10:23 +02:00
message OsmAndPoiBox {
required uint32 zoom = 1; // delta encoded to parent
// size is one tile
2011-09-21 00:10:23 +02:00
required sint32 left = 2; // delta encoded (zoom)
required sint32 top = 3; // delta encoded (zoom)
optional OsmAndPoiCategories categories = 4;
2011-09-21 00:10:23 +02:00
// encoded as fixed32 length delimited
repeated OsmAndPoiBox subBoxes = 10;
2011-09-21 00:10:23 +02:00
2011-09-27 01:22:07 +02:00
// must be the last
2011-09-22 01:06:09 +02:00
optional fixed32 shiftToData = 14; // shift to OsmAndPoiBoxData message from OsmAndPoiIndex.start
// message is started when body is started
2011-09-21 00:10:23 +02:00
}
message OsmAndPoiCategories {
// sorted categories
repeated uint32 categories = 3;
}
message OsmAndPoiBoxData {
2011-09-22 01:06:09 +02:00
optional uint32 zoom = 1; // zoom level
optional uint32 x = 2; // x tile
optional uint32 y = 3; // y tile
repeated OsmAndPoiBoxDataAtom poiData = 5;
2011-09-21 00:10:23 +02:00
}
message OsmAndPoiBoxDataAtom {
2011-09-22 01:06:09 +02:00
required sint32 dx = 2; // delta encoded to OsmAndPoiBox on 24 zoom
required sint32 dy = 3; // delta encoded to OsmAndPoiBox on 24 zoom
2011-09-26 09:13:20 +02:00
repeated uint32 categories = 4;
optional string name = 6;
optional string nameEn = 7;
optional uint64 id = 8;
2011-09-22 01:06:09 +02:00
optional string openingHours = 10;
optional string site = 11;
optional string phone = 12;
optional string note = 13;
2012-05-15 20:48:06 +02:00
}
/**
* Id table 1-based. Map of sequential ids to real ids
* [1,2,3....n] -> [a1, ... an]
2012-06-07 01:10:19 +02:00
* a1,.. an - (ideally sorted) set of longs
2012-05-15 20:48:06 +02:00
*/
message IdTable {
// diff between 2 ids
2012-06-07 01:10:19 +02:00
repeated sint64 routeId = 1;
2012-05-15 20:48:06 +02:00
}
message RestrictionData {
required int32 type = 1;
required int32 from = 2;
required int32 to = 3;
optional int32 via = 4;
}
2012-06-09 00:34:13 +02:00
message RouteData {
2012-05-15 20:48:06 +02:00
// array of delta x,y sint32 (CodedIinputStream) >> 5
// first x delta to Tree.left, y to delta Tree.top (next delta to previous)
2012-06-09 00:34:13 +02:00
required bytes points = 1;
// continuous array of pairs
// [pointIndex - int32, pointTypes - bytes]
// bytes - array of raw var int types
optional bytes pointTypes = 4;
2012-05-15 20:48:06 +02:00
// array of raw var int types
required bytes types = 7;
required int32 routeId = 12; // id internal
2012-06-06 23:37:21 +02:00
// repeated array<pair<tagId : raw_var_int, indexOfStringInParent : raw_var_int> >
optional bytes stringNames = 14; // in parent block
2012-05-15 20:48:06 +02:00
}
message OsmAndRoutingIndex {
required string name = 1;
repeated RouteEncodingRule rules = 2;
message RouteEncodingRule {
required string tag = 3;
required string value = 5;
// it is optional because natural order in block of rules
// is the same as id (id is 1-based and order)
optional uint32 id = 7;
}
2012-10-18 17:06:15 +02:00
// encoded as fixed32 length delimited
2012-10-20 14:46:13 +02:00
repeated RouteDataBox rootBoxes = 3;
2012-10-18 17:06:15 +02:00
// encoded as fixed32 length delimited
2012-10-20 14:46:13 +02:00
repeated RouteDataBox basemapBoxes = 4;
2012-10-18 17:06:15 +02:00
2012-05-15 20:48:06 +02:00
// encoded as fixed32 length delimited
2012-10-20 14:46:13 +02:00
optional RouteBorderBox borderBox = 7;
2012-05-15 20:48:06 +02:00
// encoded as fixed32 length delimited
2012-10-20 14:46:13 +02:00
optional RouteBorderBox baseBorderBox = 8;
2012-05-15 20:48:06 +02:00
repeated RouteDataBlock blocks = 5;
message RouteDataBox {
// for root box is absolute coordinates
required sint32 left = 1; // delta encoded
required sint32 right = 2; // delta encoded
required sint32 top = 3; // delta encoded
required sint32 bottom = 4; // delta encoded
//shift from routeDataBox start to message RouteDataBlock
optional fixed32 shiftToData = 5;
repeated RouteDataBox boxes = 7;
}
message RouteDataBlock {
// coordinates can take much space 4*4*count of data blocks=
// required sint32 left = 1; // delta encoded
// required sint32 right = 2; // delta encoded
// required sint32 top = 3; // delta encoded
// required sint32 bottom = 4; // delta encoded
optional IdTable idTable = 5;
2012-06-06 23:37:21 +02:00
optional StringTable stringTable = 8;
2012-05-15 20:48:06 +02:00
repeated RouteData dataObjects = 6;
repeated RestrictionData restrictions = 7;
2012-06-06 23:37:21 +02:00
2012-05-15 20:48:06 +02:00
}
2012-10-20 14:46:13 +02:00
message RouteBorderBox {
required OsmAndTileBox boundaries = 1;
optional uint32 tileZoomToSplit = 2;
repeated RouteBorderLine borderLines = 6;
repeated RouteBorderPointsBlock blocks = 7;
}
message RouteBorderLine {
// relative to left to boundary top/left
required int32 x = 1;
required int32 y = 2;
optional int32 tox = 3;
optional int32 toy = 4;
required fixed32 shiftToPointsBlock = 7 ;
}
message RouteBorderPointsBlock {
required int32 x = 1;
required int32 y = 2;
required int64 baseId = 3;
2012-10-18 17:06:15 +02:00
2012-10-20 14:46:13 +02:00
repeated RouteBorderPoint points = 5;
2012-10-18 17:06:15 +02:00
}
2012-10-20 14:46:13 +02:00
message RouteBorderPoint {
2012-10-18 17:06:15 +02:00
// related to previous point or to the parent if it is first point
optional int32 dx = 1;
optional int32 dy = 2;
2012-10-20 14:46:13 +02:00
// direction from left or top
optional int32 direction = 3;
2012-10-18 17:06:15 +02:00
optional bytes types = 4;
2012-10-22 21:44:54 +02:00
// delta from previous point
2012-10-18 17:06:15 +02:00
optional sint64 roadId = 7;
}
}