OSM Mobile Binary Protocol/Feature Tags

From OpenStreetMap Wiki
Jump to: navigation, search

Feature Tags

Features for Nodes/Ways and Relations are defined as a key which determines the type of data stored followed by the value in that type.

  • Property Key (8bit)
  • One Of:
    • Enumeration Value (8bit)
    • Signed Integer Value (32bit)
    • Packed Time (32bit)
    • String length (8bit) + String (utf8 encoded string of strlen bytes)

Keys

Name to index lookup, items that have a value picked from a specific list are given id's 0-127, items with numeric values 128-191, and text values 192-255. Add relevant new properties to the end of each list.

//enum based
"highway"=>1,
"cycleway"=>2,
"tracktype"=>3,
"waterway"=>4,
"railway"=>5,
"aeroway"=>6,
"aerialway"=>7,
"power"=>8,
"man_made"=>9,
"leisure"=>10,
"amenity"=>11,
"shop"=>12,
"tourism"=>13,
"historic"=>14,
"landuse"=>15,
"military"=>16,
"natural"=>17,
"route"=>18,
"boundary"=>19,
"sport"=>20,
"abutters"=>21,
"fenced"=>22,
"lit"=>23,
"area"=>24,
"bridge"=>25,
"cutting"=>26,
"embankment"=>27,
"surface"=>30,
"access"=>31,
"bicycle"=>32,
"foot"=>33,
"goods"=>34,
"hgv"=>35,
"horse"=>36,
"motorcycle"=>37,
"motorcar"=>38,
"psv"=>39,
"motorboat"=>40,
"boat"=>41,
"oneway"=>42,
"noexit"=>43,
"toll"=>44,
"place"=>45,
"lock"=>46,
"attraction"=>47,
"wheelchair"=>48,
"junction"=>49,
"ncn"=>50,
"rcn"=>51,
"lcn"=>52,
"network"=>53,
"state"=>54,
"mooring"=>55,
"building"=>56,
"agricultural"=>57,
"disused"=>58,
"tunnel"=>59,
"crossing"=>60,
"mountain_pass"=>61,
"narrow"=>62,
"whitewater"=>63,
"whitewater:rapid_grade"=>64,
"whitewater:section_grade"=>65,
"piste:lift"=>66,
"piste:type"=>67,
"piste:difficulty"=>68,
//extra enum values
"relation"=>127, //indicates used by a relation
//numerical
"lanes"=>128,
"layer"=>129,
"ele"=>130,
"width"=>131,
"est_width"=>132,
"maxwidth"=>133,
"maxlength"=>134,
"maxspeed"=>135,
"minspeed"=>136,
"day_on"=>137,
"day_off"=>138,
"hour_on"=>139,
"hour_off"=>140,
"maxweight"=>141,
"maxheight"=>142,
//date based
"date_on"=>176,
"date_off"=>177,
"start_date"=>178,
"end_date"=>179,
//text based
"name"=>192,
"name_left"=>193,
"name_right"=>194,
"name:*"=>195,
"int_name"=>196,
"nat_name"=>197,
"reg_name"=>198,
"loc_name"=>199,
"old_name"=>200,
"ref"=>201,
"int_ref"=>202,
"nat_ref"=>203,
"reg_ref"=>204,
"loc_ref"=>205,
"old_ref"=>206,
"ncn_ref"=>207,
"rcn_ref"=>209,
"lcn_ref"=>210,
"icao"=>211,
"iata"=>212,
"place_name"=>213,
"place_numbers"=>214,
"postal_code"=>215,
"is_in"=>216,
"note"=>217,
"description"=>218,
"image"=>219,
"source"=>220,
"source_ref"=>221,
"created_by"=>222,

Implementation Status: PHPProxy(Yes), OSMAPI(No)

Values

Enum based values:

$KTagsEnums["highway"] = Array(
	"motorway"=>1,
	"motorway_link"=>2,
	"trunk"=>3,
	"trunk_link"=>4,
	"primary"=>5,
	"primary_link"=>6,
	"secondary"=>7,
	"tertiary"=>8,
	"unclassified"=>9,
	"minor"=>10,
	"residential"=>11,
	"service"=>12,
	"track"=>13,
	"cycleway"=>14,
	"bridleway"=>15,
	"footway"=>16,
	"steps"=>17,
	"living_street"=>18,
	"bus_guideway"=>19,
	"mini_roundabout"=>20,
	"stop"=>21,
	"traffic_signals"=>22,
	"crossing"=>23,
	"gate"=>24,
	"stile"=>25,
	"cattle_grid"=>26,
	"toll_booth"=>27,
	"incline"=>28,
	"incline_steep"=>29,
	"viaduct"=>30,
	"motorway_junction"=>31,
	"services"=>32,
	"ford"=>33,
	"bus_stop"=>34,
	"turning_circle"=>35,
	"pedestrian"=>36,
	"road"=>37,
	"path"=>38,
	);
$KTagsEnums["junction"] = Array(
	"roundabout"=>1
	);
$KTagsEnums["cycleway"] = Array(
	"lane"=>1,
	"track"=>2,
	"opposite_lane"=>3,
	"opposite_track"=>4,
	"opposite"=>5
	);
const propertyLookup KTagsEnumsLanduse[] = {
	{"farm",1},
	{"farmyard",2},
	{"quarry",3},
	{"landfill",4},
	{"basin",5},
	{"reservoir",6},
	{"forest",7},
	{"allotments",8},
	{"residential",9},
	{"retail",10},
	{"commercial",11},
	{"industrial",12},
	{"brownfield",13},
	{"greenfield",14},
	{"railway",15},
	{"construction",16},
	{"military",17},
	{"cemetery",18},
	{"village_green",19},
	{"recreation_ground",20},
	{"piste",21},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsAerialway[] = {
	{"cable_car",1},
	{"chair_lift",2},
	{"drag_lift",3},
	{"station",4},
	{"gondola",5},
	{"mixed_lift",6},
	{"pylon",7},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsPistelift[] = {
	{"t-bar",1},
	{"j-bar",2},
	{"platter",3},
	{"rope_tow",4},
	{"magic_carpet",5},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsPistetype[] = {
	{"downhill",1},
	{"nordic",2},
	{"sleigh",3},
	{"sled",4},
	{"snow_park",5},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsPistedifficulty[] = {
	{"novice",1},
	{"easy",2},
	{"intermediate",3},
	{"advanced",4},
	{"expert",5},
	{"freeride",6},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsTrackType[] = {
	{"grade1",1},
	{"grade2",2},
	{"grade3",3},
	{"grade4",4},
	{"grade5",5},
	{"last-entry",0}
};
$KTagsEnums["waterway"] = Array(
	"river"=>1,
	"canal"=>2,
	"stream"=>3,
	"drain"=>4,
	"dock"=>5,
	"lock_gate"=>6,
	"turning_point"=>7,
	"aquaduct"=>8,
	"boatyard"=>9,
	"water_point"=>10,
	"weir"=>11,
	"dam"=>12,
	"riverbank"=>13,
	);
$KTagsEnums["boundary"] = Array(
	"administrative"=>1,
	"civil"=>2,
	"political"=>3,
	"national_park"=>4,
	"world_country"=>5, //course outline of the country's of the world
	);
$KTagsEnums["abutters"] = Array(
	"residential"=>1,
	"retail"=>2,
	"industrial"=>3,
	"commercial"=>4,
	"mixed"=>5,
	);
$KTagsEnums["railway"] = Array(
	"rail"=>1,
	"tram"=>2,
	"light_rail"=>3,
	"subway"=>4,
	"station"=>5,
	"preserved"=>6,
	"disused"=>7,
	"abandoned"=>8,
	"narrow_gauge"=>9,
	"monorail"=>10,
	"halt"=>11,
	"tram_stop"=>12,
	"viaduct"=>13
	"crossing"=>14,
	"level_crossing"=>15,
	"subway_entrance"=>16,
	"turntable"=>17
	);
$KTagsEnums["natural"] = Array(
	"coastline"=>1,
	"water"=>2,
	"wood"=>3,
	"peak"=>4,
	"spring"=>5,
	"glacier"=>6,
	"volcano"=>7,
	"cliff"=>8,
	"scree"=>9,
	"scrub"=>10,
	"fell"=>11,
	"heath"=>12,
	"marsh"=>13,
	"mud"=>14,
	"beach"=>15,
	"bay"=>16,
	"land"=>17,
	"cave_entrance"=>18,
	"tree"=>19,
	);
$KTagsEnums["amenity"] = Array(
	"hospital"=>1,
	"pub"=>2,
	"parking"=>3,
	"post_office"=>4,
	"fuel"=>5,
	"telephone"=>6,
	"toilets"=>7,
	"post_box"=>8,
	"school"=>9,
	"supermarket"=>10,
	"library"=>11,
	"theatre"=>12,
	"cinema"=>13,
	"police"=>14,
	"fire_station"=>15,
	"restaurant"=>16,
	"fastfood"=>17,
	"bus_station"=>18,
	"place_of_worship"=>19,
	"cafe"=>20,
	"bicycle_parking"=>21,
	"public_building"=>22,
	"grave_yard"=>23,
	"university"=>24,
	"college"=>25,
	"townhall"=>26,
	"arts_centre"=>27,
	"atm"=>28,
	"baby_hatch"=>29,
	"bank"=>30,
	"biergarten"=>31,
	"bicycle_rental"=>32,
	"bureau_de_change"=>33,
	"car_rental"=>34,
	"car_sharing"=>35,
	"courthouse"=>36,
	"crematorium"=>37,
	"drinking_water"=>38,
	"ferry_terminal"=>39,
	"fountain"=>40,
	"grave_yard"=>41,
	"nightclub"=>42,
	"pharmacy"=>43,
	"prison"=>44,
	"recycling"=>45,
	"taxi"=>46,
	"theatre"=>47,
	"veterinary"=>48,
	"dentist"=>49,
	"doctor"=>50,
	"doctors"=>50,
	"surgery"=>50,
	"emergency_phone"=>51,
	"park_bench"=>52,
	"bench"=>52,
	"playground"=>53,
	"shelter"=>54},
	"ambulance_station"=>56,
	);
$KTagsEnums["place"] = Array(
	"continent"=>1,
	"country"=>2,
	"state"=>3,
	"region"=>4,
	"county"=>5,
	"city"=>6,
	"town"=>7,
	"village"=>8,
	"hamlet"=>9,
	"suburb"=>10,
	);
$KTagsEnums["leisure"] = Array(
	"park"=>1,
	"common"=>2,
	"garden"=>3,
	"nature_reserve"=>4,
	"fishing"=>5,
	"slipway"=>6,
	"water_park"=>7,
	"pitch"=>8,
	"track"=>9,
	"marina"=>10,
	"stadium"=>11,
	"golf_course"=>12,
	"sports_centre"=>13,
	);
const propertyLookup KTagsEnumsTourism[] = {
	{"information",1},
	{"hotel",1},
	{"motel",2},
	{"guest_house",3},
	{"hostel",4},
	{"chalet",5},
	{"camp_site",6},
	{"caravan_site",7},
	{"picnic_site",8},
	{"viewpoint",9},
	{"theme_park",10},
	{"attraction",11},
	{"zoo",12},
	{"artwork",13},
	{"museum",14},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsSport[] = {
	{"10pin",1},
	{"athletics",2},
	{"australian_football",3},
	{"archery",4},
	{"baseball",5},
	{"basketball",6},
	{"boules",7},
	{"bowls",8},
	{"canoe",9},
	{"chess",10},
	{"climbing",11},
	{"cricket",12},
	{"cricket_nets",13},
	{"croquet",14},
	{"cycling",15},
	{"dog_racing",16},
	{"equestrian",17},
	{"football",18},
	{"golf",19},
	{"gymnastics",20},
	{"hockey",21},
	{"horse_racing",22},
	{"motor",23},
	{"multi",24},
	{"pelota",25},
	{"racquet",26},
	{"rowing",27},
	{"rugby",28},
	{"shooting",29},
	{"skating",30},
	{"skateboard",31},
	{"soccer",32},
	{"swimming",33},
	{"skiing",34},
	{"table_tennis",35},
	{"team_handball",36},
	{"tennis",37},
	{"orienteering",38},
	{"last-entry",0}
};
$KTagsEnums["historic"] = Array(
	"castle"=>1,
	"monument"=>2,
	"museum"=>3,
	"archaeological_site"=>4,
	"icon"=>5,
	"ruins"=>6
	);
const propertyLookup KTagsEnumsWhitewater[] = {
	{"put_in",1},
	{"egress",2},
	{"put_in;egress",3},
	{"egress;put_in",3},
	{"hazard",4},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsWhitewaterGrade[] = {
	{"1",1},
	{"1+",1},
	{"1-",1},
	{"2",2},
	{"2+",2},
	{"2-",2},
	{"3",3},
	{"3+",3},
	{"3-",3},
	{"4",4},
	{"4+",4},
	{"4-",4},
	{"5",5},
	{"5+",5},
	{"5-",5},
	{"unknown",9},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsBuilding[] = {
	{"yes",1},
	{"true",1},
	{"building",1},
	{"university",2},
	{"school",3},
	{"hall",4},
	{"hospital",5},
	{"castle",6},
	{"supermarket",7},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsManMade[] = {
	{"beacon",1},
	{"crane",2},
	{"gasometer",3},
	{"lighthouse",4},
	{"pier",5},
	{"pipeline",6},
	{"reservoir_covered",7},
	{"surveillance",8},
	{"survey_point",9},
	{"tower",10},
	{"wastewater_plant",11},
	{"watermill",12},
	{"water_tower",13},
	{"windmill",14},
	{"works",15},
	{"piste:halfpipe",16},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsRoute[] = {
	{"bus",1},
	{"ferry",2},
	{"flight",3},
	{"subsea",4},
	{"ski",5},
	{"tour",6},
	{"pub_crawl",7},
	{"ncn",8},
	{"rcn",9},
	{"lcn",10},
	{"bicycle",11},
	{"last-entry",0}
};
$KTagsEnums["oneway"] = Array(
	"no"=>0,
	"false"=>0,
	"yes"=>1,
	"true"=>1,
	"1"=>1,
	"-1"=>2
	);
const propertyLookup KTagsEnumsMooring[] = {
	{"yes",1},
	{"private",2},
	{"no",3},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsXcn[] = {
	{"yes",1},
	{"proposed",2},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsState[] = {
	{"yes",1},
	{"proposed",2},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsNetwork[] = {
	{"ncn",1},
	{"rcn",2},
	{"lcn",3},
	{"icn",4},
	{"National Byway",5},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsRestriction[] = {
	{"yes",1},
	{"designated",2},
	{"private",3},
	{"permissive",4},
	{"destination",5},
	{"unknown",6},
	{"no",7},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsBridge[] = {
	{"yes",1},
	{"aqueduct",2},
	{"viaduct",3},
	{"swing",4},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsSurface[] = {
	{"paved",1},
	{"cobbled",2},
	{"cobblestone",2},
	{"unpaved",3},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsCrossing[] = {
	{"no",1},
	{"traffic_signals",2},
	{"uncontrolled",3},
	{"island",4},
	{"zebra",5},
	{"pelican",6},
	{"toucan",7},
	{"pegasus",8},
	{"unknown",9},
	{"last-entry",0}
};
const propertyLookup KTagsEnumsYesNo[] = {
	{"yes",1},
	{"no",2},
	{"last-entry",0}
};

Numerical values are stored as a 32bit signed integer.

Dates are stored as unix time stamps (32bit unsigned integers)

Strings are truncated to 255 chars and stored as 8bit char count followed by that many charactors.

Implementation Status: PHPProxy(Yes), OSMAPI(No)