|
|
|
@@ -277,10 +277,10 @@ class GeoJsonValidator:
|
|
|
|
|
"""
|
|
|
|
|
features = self._input_geojson.get("features", [])
|
|
|
|
|
|
|
|
|
|
is_input_geojson_empty = len(self._input_geojson) == 0
|
|
|
|
|
is_input_geojson_empty_str = len(self._input_geojson) == 0
|
|
|
|
|
no_features_in_input_found = len(features) == 0
|
|
|
|
|
|
|
|
|
|
if not is_input_geojson_empty and no_features_in_input_found:
|
|
|
|
|
if not is_input_geojson_empty_str and no_features_in_input_found:
|
|
|
|
|
# check if _input_geojson is a feature itself
|
|
|
|
|
if self.__is_geojson_feature():
|
|
|
|
|
features = [
|
|
|
|
@@ -288,6 +288,9 @@ class GeoJsonValidator:
|
|
|
|
|
"geometry": self._input_geojson
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
elif self.__is_geojson_featurecollection():
|
|
|
|
|
# special case if empty featurecollection received
|
|
|
|
|
pass
|
|
|
|
|
else:
|
|
|
|
|
self.__add_error("Input does not seem to be geojson")
|
|
|
|
|
return
|
|
|
|
@@ -371,4 +374,14 @@ class GeoJsonValidator:
|
|
|
|
|
has_type = self._input_geojson.get("type", None) is not None
|
|
|
|
|
has_coordinates = self._input_geojson.get("coordinates", None) is not None
|
|
|
|
|
has_properties = self._input_geojson.get("properties", None) is not None
|
|
|
|
|
return has_type and has_coordinates and has_properties
|
|
|
|
|
return has_type and has_coordinates and has_properties
|
|
|
|
|
|
|
|
|
|
def __is_geojson_featurecollection(self):
|
|
|
|
|
""" Checks whether _input_geojson is a geojson featurecollection
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
is_fc_type = self._input_geojson.get("type", None) == "FeatureCollection"
|
|
|
|
|
has_feature_attribute = isinstance(self._input_geojson.get("features", None), list)
|
|
|
|
|
return is_fc_type and has_feature_attribute
|