tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

stange source.bounds behavior #746

Closed Zaitsev closed 4 years ago

Zaitsev commented 4 years ago

TANGRAM VERSION:

0.20

If you're not using the latest version, please try that first before filing an issue!

ENVIRONMENT:

https://play.tangram.city/?#4.167/57.429/1.644

TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:

sources:
    nextzen:
        type: TopoJSON
        url: https://tile.nextzen.org/tilezen/vector/v1/all/{z}/{x}/{y}.topojson
        bounds: [4.6917305, 52.6455735, 4.7323208, 52.6613424]
layers:
    water:
        data: { source: nextzen }
        draw:
            polygons:
                order: 2
                color: '#353535'
    earth:
        data: { source: nextzen }
        draw:
            polygons:
                order: 1
                color: '#555555'

RESULT:

clipping rectangle "jumpy" not consistent with coordinates, its scaling etc

I'd tested it with bounds from documentation bounds: [-74.1274, 40.5780, -73.8004, 40.8253] with the same errors

tngr

EXPECTED RESULT:

it should clipp map by given bounds coordinates

bcamper commented 4 years ago

Hi - this looks like the intended behavior. The bounds parameter determines which tiles are requested for a data source, but it is not a visual clipping parameter. The primary intended use of the feature is to avoid 404 tile responses (spurious errors), usually in cases where the geometry does not extend outside of the bounds, so effect you are pointing out is not visible (e.g. empty area around features that are completely inside the bounds). You would have to implement any visual clipping of geometry yourself, if you need to do this client-side, you could try a data source transform function.