@classmethod<EOL><INDENT>def read_geojson(cls, path_or_json_or_string):<DEDENT>
assert path_or_json_or_string<EOL>data = None<EOL>if isinstance(path_or_json_or_string, (dict, list)):<EOL><INDENT>data = path_or_json_or_string<EOL><DEDENT>try:<EOL><INDENT>data = json.loads(path_or_json_or_string)<EOL><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>path = path_or_json_or_string<EOL>if path.endswith('<STR_LIT>') or path.endswith('<STR_LIT>'):<EOL><INDENT>import gzip<EOL>contents = gzip.open(path, '<STR_LIT:r>').read().decode('<STR_LIT:utf-8>')<EOL><DEDENT>else:<EOL><INDENT>contents = open(path, '<STR_LIT:r>').read()<EOL><DEDENT>data = json.loads(contents)<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>pass<EOL><DEDENT>assert data, '<STR_LIT>'<EOL>return cls(cls._read_geojson_features(data))<EOL>
Read a geoJSON string, object, or file. Return a dict of features keyed by ID.