google-maps-static-api

Style and display buildings


I want to create a static google maps image which displays buildings (and buildings only). I looked through the Styled Maps page on static maps stylings, but I couldn't find an option for buildings in particular.

Please note that this should also work in less populated areas, so simply turning the landscape one colour and showing the roads in another does not suffice (like done in this image).

Is there a way to create such a map?


Solution

  • The closest feature for buildings would be the landscape.man_made feature which selects structures built by humans. You can also experiment on other features that may suite your needs such as points of interest.

    For features that you want to hide from the map, you can set the style to visibility:off for that specific feature.

    Here's an example that changes the stroke color for all man made landscapes and hides all roads:

    https://maps.googleapis.com/maps/api/staticmap?size=512x512&zoom=17&center=Brooklyn&style=feature:landscape.man_made|element:geometry.stroke|color:0xff0000&style=feature:road|visibility:off&key=YOUR_API_KEY
    

    enter image description here

    Note that the sample uses the element geometry.stroke which selects only the stroke of the feature's geometry.

    Hope this helps!