looks_like_reference

geodetic_engine.persistablereference.looks_like_reference(value)[source]

Whether a string is shaped like a persistableReference.

Inspects top-level JSON keys after bounded URL decoding. The embedded definition is not validated, so a matching payload can still be malformed.

Opening as a JSON object is not enough to go on: PROJJSON opens the same way, and claiming one of those would stop a perfectly good CRS definition from resolving. So a member only this format has must be present too.

Parameters:

value (str) – Any user-supplied definition.

Return type:

bool

Returns:

True if the string opens as a JSON object carrying a member that belongs to this format, encoded or not.

Example

>>> looks_like_reference('{"type":"LBC","wkt":"GEOGCS[...]"}')
True
>>> looks_like_reference("EPSG:4326")
False
>>> looks_like_reference('{"type":"GeographicCRS","name":"WGS 84"}')
False