Newer
Older
import geopandas
from pyogrio.errors import DataSourceError
from shapely.errors import GEOSException
def is_valid(resource, file):
"""Check if the content is a readable GeoJSON file."""
with open(file.name, "rb") as f:
try:
geopandas.read_file(f)
return True
except DataSourceError:
return False
except GEOSException:
return False