예제 #1
0
def _get_spatial_metadata(cleaned_md, sensorId):
    gps_bounds = calculate_gps_bounds(cleaned_md, sensorId)

    spatial_metadata = {}
    for label, bounds in gps_bounds.iteritems():
        spatial_metadata[label] = {}
        spatial_metadata[label]["bounding_box"] = tuples_to_geojson(bounds)
        spatial_metadata[label]["centroid"] = calculate_centroid(bounds)

    return spatial_metadata
예제 #2
0
def _get_sites(cleaned_md, date, sensorId):
    """
    Returns the site name and URL for all sites associated with the centroid.
    """
    gps_bounds = calculate_gps_bounds(cleaned_md, sensorId)

    sites = {}
    for label, bounds in gps_bounds.iteritems():
        centroid = calculate_centroid(bounds)
    
        bety_sites = betydb.get_sites_by_latlon(centroid, date)
        for bety_site in bety_sites:
            site_id = str(bety_site["id"])
            sites[site_id] = {}
            sites[site_id]["sitename"] = bety_site["sitename"]
            sites[site_id]["url"] = bety_site["view_url"]
            sites['notes'] = "sitename is the plot that contains the image centroid"

    return sites.values()