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

GeoJSON specification RFC 7946 conformity #148

Open
kuanb opened this issue Nov 11, 2022 · 0 comments · May be fixed by #147
Open

GeoJSON specification RFC 7946 conformity #148

kuanb opened this issue Nov 11, 2022 · 0 comments · May be fixed by #147

Comments

@kuanb
Copy link

kuanb commented Nov 11, 2022

Per updated GeoJSON spec: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6

Polygon specification now indicates:

A linear ring MUST follow the right-hand rule with respect to the
      area it bounds, i.e., exterior rings are counterclockwise, and
      holes are clockwise.

Problem:
mercantile utilizes clockwise pattern which is the inverse of specified counter-clockwise pattern for polygon feature creation.

Impacted LoC:

[[west, south], [west, north], [east, north], [east, south], [west, south]]

Short term workaround for my use case:

def as_geom(qk: str):
    t = mercantile.quadkey_to_tile(qk)
    west, south, east, north = mercantile.bounds(t)
    return {
        "type": "Polygon",
        "coordinates": [[
            [east, north],
            [west, north],
            [west, south],
            [east, south],
            [east, north],
        ]],
    }
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

Successfully merging a pull request may close this issue.

1 participant