Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source of the formula for coordinate tranformation? #8

Open
NicoJG opened this issue Jun 11, 2021 · 0 comments
Open

Source of the formula for coordinate tranformation? #8

NicoJG opened this issue Jun 11, 2021 · 0 comments

Comments

@NicoJG
Copy link

NicoJG commented Jun 11, 2021

I am interested on where you got the formula from for the coodinate transformation?

I was searching for how to convert the coordinates of a Mapbox Vector Tile into Geodetical coordinate for a long time.

Do you have any resources that could help me understand this coordinate transformation?

The formula is implemented in the python-vt2geojson/vt2geojson/features.py file:

    def toGeoJSON(self):
        size = self.extent * 2 ** self.z
        x0 = self.extent * self.x
        y0 = self.extent * self.y

        def project_one(p_x, p_y):
            y2 = 180 - (p_y + y0) * 360. / size
            long_res = (p_x + x0) * 360. / size - 180
            lat_res = 360. / pi * atan(exp(y2 * pi / 180)) - 90
            return [long_res, lat_res]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant