Esempio n. 1
0
 def make_geometrycollection_from_featurecollection(self, feature_collection):
     geoms = []
     #features = json.loads(feature_collection)
     gc = GeometryCollection()
     for feature in feature_collection['features']:
         feature_geom = json.dumps(feature['geometry'])
         geos_geom = (GEOSGeometry(feature_geom))
         gc.append(geos_geom)
     return gc
Esempio n. 2
0
def get_geometry(item):
    if 'Polygoon' in item:
        polygon = item['Polygoon']
        if type(polygon) == list:
            functional_errors.append(
                'Object has more than one Polygon:  {}'.format(item['Id']))
            polygon = polygon[0]
        gm = GEOSGeometry(polygon)
        if gm.geom_type == 'GeometryCollection':
            return gm
        geometry = GeometryCollection(gm)
    elif 'Punt' in item and type(item['Punt']) == list:
        geometry = GeometryCollection()
        for p in item['Punt']:
            geometry.append(GEOSGeometry(p))
    else:
        geometry = None
    return geometry