warnings.warn("The vfs keyword argument is deprecated. Instead, pass a URL that uses a zip or tar (for example) scheme.",FionaDeprecationWarning,stacklevel=2)
"""Returns a list of layer names in their index order.
deflistlayers(fp,vfs=None):
"""List layer names in their index order
Parameters
----------
fp : URI (str or pathlib.Path), or file-like object
A dataset resource identifier or file object.
vfs : str
This is a deprecated parameter. A URI scheme such as "zip://"
should be used instead.
The required ``path`` argument may be an absolute or relative file or
directory path.
Returns
-------
list
A list of layer name strings.
A virtual filesystem can be specified. The ``vfs`` parameter may be
an Apache Commons VFS style string beginning with "zip://" or
"tar://"". In this case, the ``path`` must be an absolute path within
that container.
"""
ifnotisinstance(path,string_types):
raiseTypeError("invalid path: %r"%path)
ifhasattr(fp,'read'):
withMemoryFile(fp.read())asmemfile:
return_listlayers(memfile.name)
else:
ifisinstance(fp,Path):
fp=str(fp)
ifnotisinstance(fp,string_types):
raiseTypeError("invalid path: %r"%fp)
ifvfsandnotisinstance(vfs,string_types):
raiseTypeError("invalid vfs: %r"%vfs)
ifvfs:
warnings.warn("The vfs keyword argument is deprecated. Instead, pass a URL that uses a zip or tar (for example) scheme.",FionaDeprecationWarning,stacklevel=2)