Esempio n. 1
0
 def getPhylaMetadata(self):
     """
     Returns metadata for all phyla of a specific kingdom
     """
     phyla = self.QuerySet.filter(kingdom_id=self.id).values('phylum_id').annotate(points=Collect('geom'),ab=Count('phylum_id'),name=Min('phylum'))
     return phyla    
Esempio n. 2
0
#Select the study area
study_area = nt.parent.biomeGeometry

ecoregions = Ecoregion.objects.all()
ecoregions_in_area = ecoregions.filter(geom__within=study_area)

zonenumbers = list(set(map(lambda e: e.num_zona, ecoregions_in_area)))

z_numbers = filter(lambda x: x != None, zonenumbers)

from django.contrib.gis.db.models import Union, Min
regions_polys_merged = {}
for i in z_numbers:
    regions_polys_merged[int(i)] = ecoregions_in_area.filter(
        num_zona=int(i)).aggregate(polygon=Union('geom'),
                                   name=Min('nomzonecol'.encode('latin-1')),
                                   zone_id=Min('num_zona'))

regions_polys = {}
for i in z_numbers:
    regions_polys[int(i)] = map(lambda p: p.geom,
                                ecoregions_in_area.filter(num_zona=int(i)))

#===============================================================================
#
# taxonomies_per_ecoregion = {}
# for i in z_numbers:
#     tax_list = []
#     for poly in regions_polys[int(i)]:
#         tax_list.append(map(lambda t : t.biomeGeometry.intersects(poly),l9.taxonomies))
#     taxonomies_per_ecoregion[i] = tax_list
Esempio n. 3
0
 def getClassesMetadata(self):
     """
     Returns metadata for all classes of a specific order
     """
     classes = self.QuerySet.filter(phylum_id=self.id).values('class_id').annotate(points=Collect('geom'),ab=Count('class_id'),name=Min('_class'))
     return classes    
Esempio n. 4
0
 def getOrdersMetadata(self):
     """
     Returns metadata for all classes of a specific order
     """
     orders = self.QuerySet.filter(class_id=self.id).values('order_id').annotate(points=Collect('geom'),ab=Count('order_id'),name=Min('_order'))
     return orders    
Esempio n. 5
0
 def getFamiliesMetadata(self):
     """
     Returns metadata for all families of a specific class
     """
     families = self.QuerySet.filter(order_id=self.id).values('family_id').annotate(points=Collect('geom'),ab=Count('family_id'),name=Min('family'))
     return families
Esempio n. 6
0
 def getGenusMetadata(self):
     """
     Returns metadata for all genus of a specific family
     """
     genera = self.QuerySet.filter(family_id=self.id).values('genus_id').annotate(points=Collect('geom'),ab=Count('genus_id'),name=Min('genus'))
     return genera
Esempio n. 7
0
 def getSpeciesMetadata(self):
     """
     Returns metadata for all species at a specific genus
     """
     species = self.QuerySet.filter(genus_id=self.id).values('species_id').annotate(points=Collect('geom'),ab=Count('species_id'),name=Min('scientific_name'))
     return species