Beispiel #1
0
def prepare_task_coverage(feature_collection):
    """
    Loads GeoJSON string of a FeatureCollection, validates and fixes
    all geometries and returns a single MultiPolygon GeoJSON string back.
    """
    task_coverage_geometry = geometry_from_feature_collection(json.loads(feature_collection))
    if not task_coverage_geometry:
        return None
    return json.dumps(shapely.geometry.mapping(task_coverage_geometry))
Beispiel #2
0
def prepare_task_coverage(feature_collection):
    """
    Loads GeoJSON string of a FeatureCollection, validates and fixes
    all geometries and returns a single MultiPolygon GeoJSON string back.
    """
    task_coverage_geometry = geometry_from_feature_collection(
        json.loads(feature_collection))
    if not task_coverage_geometry:
        return None
    return json.dumps(shapely.geometry.mapping(task_coverage_geometry))
Beispiel #3
0
def prepare_task_coverage(feature_collection):
    """
    Loads GeoJSON string of a FeatureCollection, validates and fixes
    all geometries and returns a single MultiPolygon GeoJSON string back.
    """
    feature_collection = json.loads(feature_collection)
    if not feature_collection:
        return None
    if feature_collection['type'] == 'Polygon':
        feature_collection = {
            "type": "FeatureCollection",
            "features": [{
                "geometry": feature_collection,
                "type": "Feature",
                "properties": {}
            }]
        }
    task_coverage_geometry = geometry_from_feature_collection(feature_collection)
    if not task_coverage_geometry:
        return None
    return json.dumps(shapely.geometry.mapping(task_coverage_geometry))
Beispiel #4
0
def prepare_task_coverage(feature_collection):
    """
    Loads GeoJSON string of a FeatureCollection, validates and fixes
    all geometries and returns a single MultiPolygon GeoJSON string back.
    """
    feature_collection = json.loads(feature_collection)
    if not feature_collection:
        return None
    if feature_collection['type'] == 'Polygon':
        feature_collection = {
            "type":
            "FeatureCollection",
            "features": [{
                "geometry": feature_collection,
                "type": "Feature",
                "properties": {}
            }]
        }
    task_coverage_geometry = geometry_from_feature_collection(
        feature_collection)
    if not task_coverage_geometry:
        return None
    return json.dumps(shapely.geometry.mapping(task_coverage_geometry))