mapzen

Polygon with texture in mapzen


I use mapzen for drawing vector tiles on client side.

How can I draw polygon with texture?

I have tried few variants such as:

  1. Materials
  2. Textures
  3. Styles

Thanks!


Solution

  • You're on the right track with using all three of those! I'd look over the textures documentation to see the different options for textures in Tangram.

    Here's an example:

    sources:
        mapzen:
            type: TopoJSON
            url: https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson
    
    styles:
        waves:
            base: polygons
            material:
                diffuse:
                    texture: https://raw.githubusercontent.com/kkowalsky/tangram-hackz/master/img/seigaiha.png
                    mapping: planar
                    scale: 0.0000003
    
    layers:
        water:
            data: { source: mapzen }
            draw:
                waves:
                    order: 1
                    color: white