Skip to content

[Possible feature?] Points and polygons from plus codes #23

Closed
@aazuspan

Description

@aazuspan

Hi @davemlz. First of all, eemont is a great tool. Thanks for creating it!

I'm not sure if you're familiar with open location code, but it's a geocoding tool that generates more readable coordinates (aka plus codes) from latitude/longitude (e.g. [39.777062, -105.006438] == 85FPQXGV+RC). Plus codes can also be shortened by including a nearby location (e.g. 85FPQXGV+RC == QXGV+RC Denver, CO).

It would be handy to have a tool for generating EE geometries from plus codes, and I was wondering if you think it would fit in eemont? Unfortunately there are no open web APIs that I know of to decode plus codes, so it would require adding openlocationcode as a dependency.

As far as implementation, I'm thinking it would extend ee.Geometry with a few static methods using your decorators. To handle shortened plus codes, an address could be geocoded using the same approach you use for ee.Geometry.PointFromQuery. Another feature might be the ability to retrieve a plus code from an ee.Geometry.Point. Usage might look something like below.

# Create a point from a full plus code
pt = ee.Geometry.PointFromPlusCode("85FPQXGV+RC")
# Create a point from a partial plus code and a nearby location reference
pt = ee.Geometry.PointFromPlusCode("QXGV+RC Denver, CO")
# Create a polygon from a list of plus codes
poly = ee.Geometry.PolygonFromPlusCodes(
    ["85GGXXJ2+R6"],
    ["85GVXVRV+5H"],
    ["859V2WJG+FQ"],
    ["859G2WQH+XF"]
)

# Create a point from coordinates
pt = ee.Geometry.Point([39.777062, -105.006438])
# Get the plus code of the point
pt.plus_code()

>> "85FPQXGV+RC"

If you think this would fit in eemont and it's worth adding another dependency for the feature, I'd be happy to implement and make a PR. If not, no worries! It could work as a little standalone package instead.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions