예제 #1
0
def overlay(request, x, y, z):
    
    from gtileoverlay.overlays import GTileOverlay
    
    qs = Airfield.objects.all()    
    icon = '/srv/closed_airfields/media/icons/red_pad.png'

    ov = GTileOverlay(x=x, y=y, zoom=z, queryset=qs, icon=icon, field='location')
    
    return ov.as_response()
예제 #2
0
파일: views.py 프로젝트: priestc/fanmarkers
def overlay(request, z, x, y, o):
    import os

    from gtileoverlay.overlays import GTileOverlay
    from django.conf import settings

    ICONS_DIR = os.path.join(settings.PROJECT_PATH, "media", "icons")

    just_routes = Airport.route.all()
    all_bases = Airport.base.all()

    all_hiring = Airport.hiring.all()
    not_hiring = Airport.not_hiring.all()

    just_hiring = Airport.objects.filter(
        Q(opbase__choice__in=Status.objects.exclude(advertising=True))
        | Q(opbase__assign__in=Status.objects.exclude(advertising=True))
    )
    # advertising = Airport.objects.filter(Q(opbase__choice__in=Status.objects.filter(advertising=True)) | Q(opbase__assign__in=Status.objects.filter(advertising=True)))

    ##########

    if int(z) < 6:
        size = "/small"
    else:
        size = "/big"

    ov = GTileOverlay(z, x, y, queryset=just_routes, field="location")
    ov.icon(ICONS_DIR + size + "/route.png")  # light blue icons for route bases

    ov = GTileOverlay(z, x, y, queryset=all_bases, image=ov.output(shuffle=False), field="location")
    ov.icon(ICONS_DIR + size + "/base.png")  # green icons for no status bases

    ov = GTileOverlay(
        z, x, y, queryset=all_hiring, image=ov.output(shuffle=False), field="location"
    )  # red for hiring bases
    ov.icon(ICONS_DIR + size + "/hiring.png")

    # ov = GTileOverlay(z,x,y, queryset=advertising, image=ov.output(shuffle=False), field="location")               # red-gold for advertising bases
    # ov.icon(ICONS_DIR + size + '/advertising.png')

    #############################################################

    response = HttpResponse(mimetype="image/png")
    ov.output(shuffle=False).save(response, "PNG")
    return response