It is similar a shot real slow to practise a edifice tiptop map inward only a few curt steps using Mapbox.
This calendar week Mapbox announced that their Mapbox Streets v7 vector tiles similar a shot include edifice tiptop data. This agency that you lot tin hand the sack usage Mapbox Studio to manner buildings on Mapbox Streets v7 past times the tiptop of the buildings. In other words you lot tin hand the sack color edifice footprints on a map to practise a edifice tiptop map.
Here's How
1. Open Mapbox 'Streets' inward Mapbox Studio.
2. Select the 'Building' layer.
3. Under 'Style' alter the color of the edifice footprint.
4. Under 'Select Data' add together 2 filters to define the attain of the edifice heights you lot desire to last this color.
In the screenshot you lot tin hand the sack come across I've chosen to color all buildings amongst a tiptop greater than 0 in addition to less than 6.
That's it! You should similar a shot accept a map that colors all the edifice footprints amongst a tiptop nether 6.
But you lot why goal there. You tin hand the sack too add together dissimilar colors for buildings amongst dissimilar heights.
5. Duplicate your 'Building' layer.
6. In your 'Building Copy' layer alter the 2 filters you lot added inward a higher house to 'height is less than 16' in addition to 'height is greater than 5'.
7. Change the color of the edifice footprint to a dissimilar color than you lot chose for buildings nether 6.
You similar a shot accept a map amongst 2 dissimilar colors for buildings amongst heights from 0-5 in addition to buildings amongst heights 6-15.
Of course of pedagogy you lot don't accept to goal at that spot either. You tin hand the sack behave on duplicating your 'Building' layer creating dissimilar colors for buildings amongst dissimilar tiptop ranges.
Here is my completed Building Heights Map. In my map I've deleted every layer apart from my styled edifice layers. If you lot desire street names in addition to /or other map features at that spot is no argue why you lot should delete these layers from your map manner inward Mapbox Studio.
Now you lot accept your finished map manner you lot mightiness desire to hand your map users or in addition to therefore controls to filter the buildings shown on the map past times edifice height. This is real slow to practise using Mapbox's setPaintProperty function. In this Change a layer's color amongst buttons map demo you lot should last able to come across how you lot tin hand the sack practise buttons to plough your dissimilar edifice tiptop layers on in addition to off. You could practise buttons which switch the colors of your dissimilar layers betwixt the map background color in addition to the color you lot assigned to each layer inward Mapbox Studio.
Alternatively you lot could allow your users to selection the color of each edifice tiptop attain for themselves. I used Mapbox's 'Change a layer's color amongst buttons' demo map in addition to only dropped inward my edifice tiptop layers to practise a map where users tin hand the sack selection their ain colors.
Here is the completed Building Height Map inward JSFiddle. Just usage the drop-down card to alter the colors of the buildings past times the attain of edifice height.
Buat lebih berguna, kongsi: