Skip to content

GeoJSON specification RFC 7946 conformity #148

@kuanb

Description

@kuanb

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],
        ]],
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions