Skip to content

Double encoding of intersects request ?Β #335

@jjrom

Description

@jjrom

Addressing the resto issue - "pystac-client request with intersects fails against resto".

Apparently pystac_client sends intersects property with trailing double quotes i.e. :

from pystac_client import Client
client = Client.open("https://tamn.snapplanet.io")
collection = "S2"
geometry = '{"type": "Polygon", "coordinates": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}'
search = client.search(method="GET", collections=[collection], intersects=geometry)
print(len(list(search.items_as_dicts())))

On resto side, the intersects property string retrieved format is the following:

intersects= "\"{\\\"type\\\": \\\"Polygon\\\", \\\"coordinates\\\": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}\""

It looks like there is a double encoding of the string (i.e. trailing double quotes and slashes). The right encoding should be:

intersects= "{\"type\": \"Polygon\", \"coordinates\": [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]]]}"

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions