Example #1
0
def find_star():
    year = int(request.args.get("year"))
    month = int(request.args.get("month"))
    day = int(request.args.get("day"))
    hour = int(request.args.get("hour"))
    minute = int(request.args.get("minute"))
    longitude = int(request.args.get("lon"))
    latitude = int(request.args.get("lat"))
    azd = int(request.args.get("az_offset"))
    altd = int(request.args.get("alt_offset"))
    az = float(request.args.get("az"))
    alt = float(request.args.get("alt"))

    longitude = longitude / 360.0 * 24.0
    azd = azd / 360.0 * 24.0

    az = az / 360.0 * 24.0
    if az < 0:
        az = az + 24

    cache = CacheClient()
    source = IndexedSource(year, month, day, hour, minute, longitude, latitude, azd, altd, cache)
    id, azalt = source.get_star(az, alt)

    oaz, oalt = azalt
    assert oaz >= 0
    if oaz > 12:
        oaz = oaz - 24

    return '["%s", "%s", "%s"]' % (id, oaz*360.0/24.0, oalt)
Example #2
0
def svg_lines(year, month, day, hour, minute, longitude, latitude, azd, altd, zoom, x, y):
    start = time()
    try:
        if CacheClient:
            cache = CacheClient()
        else:
            cache = None

        longitude = longitude / 360.0 * 24.0
        azd = azd / 360.0 * 24.0

        source = IndexedSource(year, month, day, hour, minute, longitude, latitude, azd, altd, cache)
        bounds, sky_objects = source.get_constellation_lines(zoom, x, y)
        return svg_line_tile(zoom, x, y, bounds, sky_objects)
    finally:
        info("Tile generation end %.1fs" % (time() - start))