Skip to content
Last updated

You can get way attributes using the Street Attributes API by sending an HTTP GET request to the V2 way-attributes method (REST).

The following example shows the URL of a REST request to the way-attributes method:

https://dplace-api.themap.world/street-attributes/v2/ways/way-attributes?latitude={latitude}&longitude={longitude}&apikey={YOUR_API_KEY}

Include the GPS coordinate and your API key in the query parameters.

Example: HTTP street attributes request

The following code shows how to construct a way-attributes request. In this example, you set the GPS coordinate to search from, and also specify:

  • latitude for the GPS latitude, between -90 and 90
  • longitude for the GPS longitude, between -180 and 180
BASE_URL="https://dplace-api.themap.world"

curl --request GET \
  --url "${BASE_URL}/street-attributes/v2/ways/way-attributes" \
  --get \
  --data-urlencode "latitude=10.8008266" \
  --data-urlencode "longitude=106.7528268" \
  --data-urlencode "apikey=<YOUR_API_KEY>" \
  --header "Accept: application/json"

Parameters

ParameterTypeRequiredDescription
latitudefloatYesGPS latitude. Must be between -90 and 90.
longitudefloatYesGPS longitude. Must be between -180 and 180.
apikeystringYesA valid Digime API key passed as a query parameter.

Example: HTTP street attributes response body

{
  "status_code": 200,
  "message": "Found way attributes near the provided coordinates",
  "data": {
    "street_name": "Mai Chí Thọ",
    "coordinates": [
      [
        10.8028964,
        106.7532309
      ],
      [
        10.8011736,
        106.7529096
      ],
      [
        10.8007751,
        106.7528678
      ]
    ],
    "max_speed": 60,
    "attributes": [
      {
        "label": "p124a",
        "name": "Cấm quay xe",
        "type": "traffic_signs",
        "lat": 10.8015203,
        "lng": 106.7529286,
        "category": "prohibition",
        "subcategory": "turning_restriction",
        "heading": "to",
        "rules_payload": []
      },
      {
        "label": "p106b",
        "name": "Cấm xe tải ",
        "type": "traffic_signs",
        "lat": 10.8013063,
        "lng": 106.7528887,
        "category": "prohibition",
        "subcategory": "physical_restriction",
        "heading": "to",
        "rules_payload": [
          {
            "physical_limits": {
              "weight": {
                "max": 3.5,
                "unit": "ton"
              }
            },
            "lane_index": 0,
            "speed_limit_max": null,
            "speed_limit_min": null,
            "vehicle_code": [
              "truck"
            ],
            "lane_div": null,
            "turn_lanes": null
          }
        ]
      },
      {
        "label": "p127c",
        "name": "Biển ghép tốc độ tối đa cho phép theo phương tiện, trên từng làn đường",
        "type": "traffic_signs",
        "lat": 10.8008266,
        "lng": 106.7528268,
        "category": "prohibition",
        "subcategory": null,
        "heading": "to",
        "rules_payload": [
          {
            "change_lanes": "yes",
            "lane_index": 1,
            "speed_limit_max": 50,
            "speed_limit_min": null,
            "vehicle_code": [
              "bus_coach",
              "passenger_auto"
            ],
            "lane_div": "dashed",
            "turn_lanes": null
          },
          {
            "change_lanes": "yes",
            "physical_limits": {
              "weight": {
                "max": 3.5,
                "unit": "ton"
              }
            },
            "lane_index": 1,
            "speed_limit_max": 50,
            "speed_limit_min": null,
            "vehicle_code": [
              "truck"
            ],
            "lane_div": "dashed",
            "turn_lanes": null
          },
          {
            "change_lanes": "yes",
            "lane_index": 2,
            "speed_limit_max": 50,
            "speed_limit_min": null,
            "vehicle_code": [
              "moto",
              "bicycle",
              "moped",
              "bus_coach",
              "passenger_auto"
            ],
            "lane_div": "dashed",
            "turn_lanes": null
          },
          {
            "change_lanes": "yes",
            "physical_limits": {
              "weight": {
                "max": 3.5,
                "unit": "ton"
              }
            },
            "lane_index": 2,
            "speed_limit_max": 50,
            "speed_limit_min": null,
            "vehicle_code": [
              "truck"
            ],
            "lane_div": "dashed",
            "turn_lanes": null
          },
          {
            "change_lanes": "yes",
            "lane_index": 3,
            "speed_limit_max": 50,
            "speed_limit_min": null,
            "vehicle_code": [
              "moto",
              "bicycle",
              "moped",
              "cargo_bicycle",
              "auto_rickshaw",
              "3wm",
              "rickshaw"
            ],
            "lane_div": null,
            "turn_lanes": null
          },
          {
            "change_lanes": "yes",
            "lane_index": 3,
            "speed_limit_max": null,
            "speed_limit_min": null,
            "vehicle_code": [
              "auto_rickshaw"
            ],
            "lane_div": null,
            "turn_lanes": null
          }
        ]
      }
    ]
  },
  "request_id": "42f25c7f-91e9-4cdb-85fd-2639b82a0f49"
}

Example: a sign with no lane-level rules

Most signs have no lane-specific conditions at all, so rules_payload is []:

{
  "label": "p131a",
  "name": "Cấm đỗ xe",
  "type": "traffic_signs",
  "lat": 10.7697208,
  "lng": 106.7030306,
  "category": "prohibition",
  "subcategory": "stopping_parking",
  "heading": "to",
  "rules_payload": []
}

Example: rules with different physical limits aren't merged

These two rules aren't merged into one vehicle_code array because their physical_limits differ (a bus seat limit vs. a truck weight limit):

{
  "label": "p107",
  "name": "Cấm ô tô khách và ô tô tải",
  "category": "prohibition",
  "subcategory": "vehicle_restriction",
  "heading": "from",
  "rules_payload": [
    {
      "physical_limits": {
        "seats": { "max": 25, "unit": "seat" }
      },
      "access_restrictions": {
        "valid_time": [
          { "days_of_week": ["all"], "start_time": "06:00", "end_time": "08:00" },
          { "days_of_week": ["all"], "start_time": "11:00", "end_time": "13:00" },
          { "days_of_week": ["all"], "start_time": "17:00", "end_time": "19:00" }
        ]
      },
      "lane_index": 0,
      "speed_limit_max": null,
      "speed_limit_min": null,
      "vehicle_code": ["bus_coach"],
      "lane_div": null,
      "turn_lanes": null
    },
    {
      "physical_limits": {
        "weight": { "max": 2.5, "unit": "ton" }
      },
      "access_restrictions": {
        "valid_time": [
          { "days_of_week": ["all"], "start_time": "06:00", "end_time": "08:00" },
          { "days_of_week": ["all"], "start_time": "11:00", "end_time": "13:00" },
          { "days_of_week": ["all"], "start_time": "17:00", "end_time": "19:00" }
        ]
      },
      "lane_index": 0,
      "speed_limit_max": null,
      "speed_limit_min": null,
      "vehicle_code": ["truck"],
      "lane_div": null,
      "turn_lanes": null
    }
  ]
}

Example: a rule that applies to every vehicle type

When a rule applies to all vehicles, vehicle_code is expanded to the full list of vehicle classes rather than a single "all" value:

{
  "label": "p130",
  "category": "prohibition",
  "subcategory": "stopping_parking",
  "heading": "from",
  "rules_payload": [
    {
      "access_restrictions": {
        "valid_time": [
          { "days_of_week": ["all"], "start_time": "06:00", "end_time": "22:00" }
        ]
      },
      "lane_index": 0,
      "speed_limit_max": null,
      "speed_limit_min": null,
      "vehicle_code": ["auto", "moto", "truck", "bus_local", "bus_coach", "trailer", "sm-trailer", "tractor", "bicycle", "moped", "cargo_bicycle", "auto_rickshaw", "3wm", "rickshaw", "peds", "hand_cart", "taxi", "passenger_auto"],
      "lane_div": null,
      "turn_lanes": null
    }
  ]
}

Response definition

FieldTypeDescription
status_codeintegerApplication-level result code. Always 200 for this endpoint — validation and rate-limit errors use a different HTTP status and a different response body. See HTTP responses.
messagestringA short description of the result. For this endpoint it's always one of: Found way attributes near the provided coordinates (when data is populated) or No way found near the provided coordinates (when data is null).
request_idstringIdentifier used to trace the request, for example 42f25c7f-91e9-4cdb-85fd-2639b82a0f49.
dataobject/nullThe nearest way attributes. In practice null is rare: the lookup has no distance cutoff, so it returns the closest road it can find in the map data even if that road is far from the coordinate you sent. Always check that the returned coordinates are actually close to your query point before trusting the result.

data fields:

FieldTypeDescription
street_namestring/nullStreet name of the nearest way, for example Mai Chí Thọ, Pasteur, or Võ Văn Kiệt. Can also be a bare route number, such as "51", for national highways that have no local name. Returns null when no name is recorded for that road — this is common, so always handle the null case.
coordinatesarrayOrdered geometry of the nearest way, as [latitude, longitude] pairs — the opposite order from GeoJSON's [longitude, latitude]. Returns [] when the geometry can't be resolved.
max_speedintegerSpeed limit for the way, in km/h, for example 40, 50, 60, or 80.
attributesarrayTraffic signs associated with the nearest way. Returns [] when the way has no signs — most road segments have none. By default, a sign whose access_restrictions.valid_time doesn't cover the current time (in Vietnam local time) is left out of attributes entirely — the same coordinate can return a different set of signs depending on when you call the API.

Traffic-sign attributes

Each item in attributes describes one traffic sign:

FieldTypeDescription
namestringDisplay name of the traffic sign, for example Cấm quay xe or Tốc độ tối đa cho phép.
typestringAttribute type; always traffic_signs.
latnumberTraffic-sign latitude, for example 10.8015203.
lngnumberTraffic-sign longitude, for example 106.7529286.
categorystringNormalized traffic-sign category. See the category table below.
subcategorystring/nullNormalized traffic-sign subcategory. Returns null when no subcategory applies. See the label definition table below.
labelstringTraffic-sign code, for example p127, p106a, or dp135. See the label definition table below for the full list.
headingstringDirection the sign faces, relative to the road's digitized direction: to, from, or (rarely) both.
rules_payloadarrayLane-specific rules. Returns [] when the sign has no lane-level conditions — most signs (for example a plain no-parking sign) apply everywhere with no extra conditions. Treat each item as an open set of key/value pairs rather than a fixed schema: occasional extra fields from the source map data may pass through unchanged.

HTTP responses

HTTP statusMeaningDescription
200OKThe request was accepted. data contains the nearest way, or null when no way is found.
400Bad RequestThe request is malformed before it can be validated.
401Unauthorizedapikey query parameter is missing or invalid. The message text differs by cause — see the examples below.
422Validation ErrorA required query parameter is missing or invalid, for example latitude outside -90..90 or longitude outside -180..180.
429Too Many RequestsYou've exceeded the request-rate limit. Wait and retry.

Error responses (400, 401, 422, 429) don't use the same {status_code, message, data, request_id} envelope as a 200 response — check the HTTP status code first, then parse the body accordingly.

Example: HTTP 401 response body

The response shape is the same whether apikey is missing or invalid, but message differs:

Missing apikey:

{
  "message": "No API key found in request",
  "request_id": "bcfe1e1ce5c4686435b1c10d93b6172e"
}

Present but invalid apikey:

{
  "message": "Unauthorized",
  "request_id": "2ff6e06f79e67c4d965c7d27dbb13532"
}
FieldTypeDescription
messagestringUnauthorized message. No API key found in request when apikey is missing, Unauthorized when it's present but not valid.
request_idstringIdentifier of the request, useful for troubleshooting.

Example: HTTP 422 response body

Returned when a query parameter is missing or out of range:

{
  "detail": [
    {
      "loc": ["query", "latitude"],
      "msg": "Expected `float` <= 90.0"
    }
  ]
}
FieldTypeDescription
detailarrayOne item per invalid or missing parameter.
detail[].locarrayLocation of the offending value, for example ["query", "latitude"].
detail[].msgstringHuman-readable validation error.

Example: HTTP 429 response body

{
  "detail": "Rate limit exceeded. Please retry later."
}
FieldTypeDescription
detailstringRate-limit error message.

Category definition

ValueDefinition
end_of_prohibitionEnd of a prohibition or restriction.
informationProvides road, lane, direction, or service information.
mandatoryIndicates an action or direction that road users must follow.
prohibitionProhibits or restricts a road-user action.
expressway_informationProvides information specific to an expressway.
internal_definitionInternal definition used by the Street Attributes data model.
warningWarns road users or identifies a restricted manoeuvre or vehicle type.

Speed-sign definitions keep their category value, for example p127 is prohibition, dp134 is end_of_prohibition, and r306 is mandatory. Lane-specific speed values are returned as speed_limit_max or speed_limit_min inside rules_payload.

Traffic-sign subcategory definitions

The API returns the API value in the subcategory field.

API valueLabelsDefinition
stopping_parkingp130, p131a, p131b, p131cStopping and parking restriction
turning_restrictionp136, p139, p124b, p103b, p124a
p123b, p124d, p124e, p124f, p138
p103c, p123a, p124c, p137, p102
Turning restriction
vehicle_restrictionp101, p140, p108, p108a, p103a, p107a
p107b, p107, p109, p112, p106a, p106c
p111d, p105, p110b, p110a, p111a, p111b
p111c, p104, p113, p114
Vehicle restriction
overtaking_restrictionp125, p126Overtaking restriction
physical_restrictionp116, p115, p117, p118, p120, p119, p106bPhysical restriction

Traffic-sign label definitions

LabelLabel nameCategory (value)Subcategory
p127Tốc độ tối đa cho phépprohibition—
r420Bắt đầu khu đông dân cưmandatory—
p127cBiển ghép tốc độ tối đa cho phép theo phương tiện, trên từng làn đườngprohibition—
re10dHết tốc độ tối đa trong khu vựcmandatory—
w235Đường đôiwarning—
w204Đường hai chiềuwarning—
w206Giao vòng xuyếnwarning—
dgm6Giới hạn tốc độ tối đa theo làn trên đường cao tốcinternal_definition—
p130Cấm dừng và đỗ xeprohibitionstopping_parking
p136Cấm đi thẳngprohibitionturning_restriction
p139Cấm đi thẳng, rẽ phảiprohibitionturning_restriction
p108aCấm xe sơ-mi rơ-moócprohibitionvehicle_restriction
p124bCấm ô tô quay đầuprohibitionturning_restriction
p103bCấm ô tô rẽ phảiprohibitionturning_restriction
p124aCấm quay xeprohibitionturning_restriction
p123bCấm rẽ phảiprohibitionturning_restriction
p124dCấm rẽ phải và quay đầu xeprohibitionturning_restriction
p138Cấm đi thẳng, rẽ tráiprohibitionturning_restriction
dp134Hết hạn chế tốc độ x tối đaend_of_prohibition—
dp135Hết tất cả các lệnh cấmend_of_prohibition—
r421Kết thúc khu đông dân cưmandatory—
ie452Chỉ dẫn bắt đầu đường cao tốcexpressway_information—
p131aCấm đỗ xeprohibitionstopping_parking
p131cCấm đỗ xe ngày chẵnprohibitionstopping_parking
p131bCấm đỗ xe ngày lẻprohibitionstopping_parking
p103aCấm ô tôprohibitionvehicle_restriction
p107aCấm xe ô tô kháchprohibitionvehicle_restriction
p107Cấm xe khách và xe tảiprohibitionvehicle_restriction
p103cCấm ô tô rẽ tráiprohibitionturning_restriction
p123aCấm rẽ tráiprohibitionturning_restriction
p124cCấm rẽ trái và quay đầu xeprohibitionturning_restriction
p137Cấm rẽ trái, rẽ phảiprohibitionturning_restriction
p125Cấm vượtprohibitionovertaking_restriction
r306Tốc độ x tối thiểu cho phépmandatory—
p106aCấm xe ô tô tảiprohibitionvehicle_restriction
p106bCấm xe tải theo tải trọngprohibitionphysical_restriction
r303Nơi giao nhau theo vòng xuyếnmandatory—
dp133Hết cấm vượtend_of_prohibition—
p108Cấm xe kéo rơ-moócprohibitionvehicle_restriction
r307Biển báo hết hạn chế tốc độ tối thiểumandatory—
p104Cấm xe máyprohibitionvehicle_restriction
dp127aBáo đến hết đoạn đường tốc độ tối đa cho phépend_of_prohibition—
dp127cBáo đến hết đoạn đường tốc độ tối đa cho phépend_of_prohibition—
dp127bBáo đến hết đoạn đường tốc độ tối đa cho phépend_of_prohibition—
r411Hướng đi trên mỗi làn đường theo vạch kẻ đườngmandatory—
w236Biển báo hết đường đôiwarning—
dgm4Chỉ dẫn trạm thu phíinternal_definition—
ie472aBiển chỉ dẫn thu phí cao tốcexpressway_information—
ie472bBiển chỉ dẫn thu phí cao tốcexpressway_information—
dgm16Làn thu phí hỗn hợpinternal_definition—
dgm17Làn thu phí ETCinternal_definition—
p124eCấm ô tô rẽ trái và quay đầu xeprohibitionturning_restriction
p124fCấm ô tô rẽ phải và quay đầu xeprohibitionturning_restriction
p105Cấm ô tô và xe máyprohibitionvehicle_restriction
r412Biển quy định làn đường, hướng di chuyển theo phương tiệnmandatory—

Lane rules, lane changes, and valid time

rules_payload is an array of independent lane rules — each item's vehicle_code and access_restrictions.valid_time apply only to that lane rule, not to others in the array.

Example:

"rules_payload": [
  {
    "change_lanes": "yes",
    "lane_index": 0,
    "vehicle_code": ["truck"],
    "physical_limits": {
      "weight": {
        "max": 2.5,
        "unit": "ton"
      }
    },
    "access_restrictions": {
      "valid_time": [
        {
          "days_of_week": ["all"],
          "start_time": "06:00",
          "end_time": "22:00"
        }
      ]
    }
  },
  {
    "change_lanes": "yes",
    "lane_index": 1,
    "vehicle_code": ["bus_coach"],
    "access_restrictions": {
      "valid_time": [
        {
          "days_of_week": ["all"],
          "start_time": "16:00",
          "end_time": "20:00"
        }
      ]
    }
  }
]

Each rules_payload[] item may contain:

FieldTypeDescription
lane_indexintegerWhich lane this rule applies to, from 0 to 5. 0 means the rule applies to the whole road, not one specific lane (it's also the most common value — most rules aren't lane-specific). 1–5 identify individual lanes, numbered left to right.
change_lanesstring, optionalLane-change rule for this lane, for example "yes" or "no". Omitted when no lane-change rule is defined for that lane. See the allowed values below.
vehicle_codearrayVehicle classes governed by this lane rule, for example ["truck"] or ["bus_coach", "passenger_auto"]. Always a non-empty array. A rule that applies to every vehicle type is expanded into the full list of vehicle classes (see Vehicle classes) rather than a single "all" value.
speed_limit_maxinteger/nullMaximum speed for the lane, in km/h, for example 50, 60, or 70. null when no maximum speed is defined.
speed_limit_mininteger/nullMinimum speed for the lane, in km/h. null when no minimum speed is defined — most rules only set a maximum, not a minimum.
lane_divstring/nullLane-divider metadata, for example dashed or solid. null when not available.
turn_lanesstring/nullDesignated turn or merge direction for this lane, for example right. null when none applies. See the values below.
physical_limitsobject, optionalPhysical restrictions for the lane, most commonly a weight limit (for example {"weight": {"max": 3.5, "unit": "ton"}}) or a seat-count limit (for example {"seats": {"max": 25, "unit": "seat"}}). Omitted when no physical restriction applies to this lane rule.
access_restrictions.valid_timearray, optionalTime ranges for this lane rule, for example [{"days_of_week": ["all"], "start_time": "06:00", "end_time": "22:00"}]. Omitted together with access_restrictions when the sign has no time restriction.

change_lanes values:

ValueDescription
yesAllows lane changes to both the left and right when adjacent lanes exist. In the leftmost lane, it is equivalent to not_left; in the rightmost lane, it is equivalent to not_right.
noProhibits leaving the current lane; changing to another lane is not allowed.
not_rightProhibits changing to the lane on the right but allows changing to the lane on the left.
not_leftProhibits changing to the lane on the left but allows changing to the lane on the right.

turn_lanes values:

ValueDescription
leftTurn left.
throughContinue straight; equivalent to straight.
straightContinue straight; equivalent to through.
rightTurn right.
reverseMake a U-turn.
slide_leftMove to the lane on the left; equivalent to slight_left.
slight_leftMove to the lane on the left; equivalent to slide_left.
slide_rightMove to the lane on the right; equivalent to slight_right.
slight_rightMove to the lane on the right; equivalent to slide_right.
next_rightPrepare for an upcoming right turn.
merge_to_leftMerge into the lane on the left.
merge_to_rightMerge into the lane on the right.
nullNo turn-lane or merge direction is available.

access_restrictions.valid_time item fields:

FieldTypeDescription
days_of_weekarrayDays on which the lane rule is valid, for example ["all"] or ["mon", "tue", "wed", "thu", "fri"].
start_timestringStart time in HH:MM format, for example 06:00.
end_timestringEnd time in HH:MM format, for example 22:00. Can also be 24:00, meaning end of day.

Example of one time range:

{
  "days_of_week": ["all"],
  "start_time": "06:00",
  "end_time": "09:00"
}

days_of_week values:

ValueDay
monMonday
tueTuesday
wedWednesday
thuThursday
friFriday
satSaturday
sunSunday
allEvery day

Vehicle classes

ValueDefinition
autoCar, automobile.
motoMotorbike or motorcycle.
truckTruck.
bus_localLocal bus.
bus_coachCoach or passenger bus.
trailerTrailer or towing vehicle.
sm-trailerSemi-trailer.
tractorTractor.
bicycleBicycle.
mopedMoped.
cargo_bicycleCargo bicycle.
auto_rickshawAuto rickshaw.
3wmMotorized three-wheeler.
rickshawRickshaw or cyclo.
pedsPedestrian.
hand_cartHand cart.
taxiTaxi.
passenger_autoPassenger car.