Ejemplo n.º 1
0
def single_location_kml(request, ident):
    """
    Return a KMZ file representing a single location. Passed in is the ident.
    (as opposed to the pk). No routes!
    """

    l = Location.goof(identifier=ident, loc_class=1)
                     
    f = AirportFolder(name=ident, qs=[l])

    return folders_to_kmz_response([f], add_icon=True)
Ejemplo n.º 2
0
def routes_location_kml(request, ident, type):
    """
    Returns a KMZ of all routes flown to the passed location identifier,
    also adds a point over the passed identifier
    """
    
    if type == 'airport':
        lc=1
    elif type == 'navaid':
        lc=2
    else:
        lc=1
        
    #raises 404 if no location is found
    l = Location.goof(identifier=ident, loc_class=lc)
    
    qs = Route.objects\
              .filter(routebase__location__identifier=ident.upper())\
              .values('kml_rendered', 'simple_rendered')\
              .distinct()
    
    name = l.identifier
    
    return qs_to_time_kmz(qs, points=(name, [l]))