My goal is to use OpenStreetMap buildings data to create map tiles that show buildings styled with information such as name, floors, and other information from the tags associated with the way/feature in the OSM database.

Is it possible to access the name of a #building through the osm_id in Mapbox Streets or by some other method?

What is the potential use of the osm_id in Mapbox Studio?

The specific use case here is a college campus map.


Because the types of tags associated with a feature can be arbitrary and range in size, the mapbox-streets-v5 source can only included a small subset of possible OSM tags for each feature they include.

For the #building layer, they have only included osm_id, but it shouldn't be hard to look up the building in osm (or just visually identify it) and add the name manually via Carto.

Because of the way MapBox Studio handles labels, you will need to apply the name label to the #housenum_label point layer, rather than the #building polygon layer (otherwise, the label might get repeated in strange ways on buildings that exist in multiple tiles. see this

#housenum_label {
  [osm_id = xxx],[osm_id = yyy]{
    [osm_id = xxx]{ text-name = 'Name1'}
    [osm_id = yyy]{ text-name = 'Name2'}
    text-face-name: 'Open Sans Condensed Bold';
    text-size: 16;

Alternatively, if the buildings are included in the #poi_label layer, the feature will already have a name field associated with it and you won't have to manually match osm_id to name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.