Skip to content

coordsFromBbox enlarge width and height twice #27

@jingsam

Description

@jingsam

The width calculated by coordsFromBbox() is base_width * scale *scale, which should be base_width * scale. Let check out:

console.log(abaculus.coordsFromBbox(0, 2, [-180, -85.0511, 180, 85.0511], 19000, 256))
console.log(abaculus.coordsFromCenter(0, 2, {x: 0, y: 0, w: 256, h: 256}, 19000, 256))

What I got is :

{ w: 1024, h: 1024, x: 256, y: 256 } 
{ w: 512, h: 512, x: 256, y: 256 } 

We have already get the right size from here: https://github.com/mapbox/abaculus/blob/master/index.js#L42-L43

But we enlarged the size again at here: https://github.com/mapbox/abaculus/blob/master/index.js#L50-L51

And x: 256, y: 256 is definitely not the center of w: 1024, h: 1024, which proves the results calculated by coordsFromBbox is wrong.

If this problem is confirmed. I will send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions