示例#1
0
def test():
    if start_date_global == "" or end_date_global == "" or area_global == 0 or city_global == "":
        return redirect('/')

    # converting global dates to str()
    global start_date_global
    start_date_global = str(start_date_global)
    global end_date_global
    end_date_global = str(end_date_global)

    population = str(int(round(population_global)))
    mobile = str(int(round(mobile_access_global)))
    water = str(int(round(water_access_global)))
    area = str(int(round(area_global)))
    country = country_global

    difference_isEmpty = False

    city = str(city_global)
    constant = 0.009

    try:
        start_coord = mf.get_start(city)
        c_lon, c_lat = start_coord
        min_lon = c_lon - constant
        min_lat = c_lat - constant
        max_lat = c_lat + constant
        max_lon = c_lon + constant

        hospitals, h_ids = mf.get_num_hospitals(city)
        schools, s_ids = mf.get_num_schools(city)
        difference_ways, old_ways = mf.get_difference(city, start_date_global,
                                                      end_date_global)
    except ValueError:
        difference_isEmpty = True

    return render_template('search.html',
                           ways_updated=difference_ways,
                           ways_old=old_ways,
                           area=area,
                           population=population,
                           mobile=mobile,
                           water=water,
                           country=country,
                           start_coord=start_coord,
                           hospitals=hospitals,
                           schools=schools,
                           min_lon=min_lon,
                           min_lat=min_lat,
                           max_lat=max_lat,
                           max_lon=max_lon)
示例#2
0
def test():
	if start_date_global == "" or end_date_global == "" or area_global == 0 or city_global == "":
		return redirect('/')

	# converting global dates to str()
	global start_date_global
	start_date_global = str(start_date_global)
	global end_date_global
	end_date_global = str(end_date_global)

	population = str(int(round(population_global)))
	mobile = str(int(round(mobile_access_global)))
	water = str(int(round(water_access_global)))
	area = str(int(round(area_global)))
	country = country_global

	difference_isEmpty = False

	city = str(city_global)
	constant = 0.009

	try:
		start_coord = mf.get_start(city)
		c_lon, c_lat = start_coord
		min_lon = c_lon - constant
		min_lat = c_lat - constant
		max_lat = c_lat + constant
		max_lon = c_lon + constant

		hospitals, h_ids = mf.get_num_hospitals(city)
		schools, s_ids = mf.get_num_schools(city)
		difference_ways, old_ways = mf.get_difference(city,start_date_global, end_date_global)
	except ValueError:
		difference_isEmpty = True

	return render_template('search.html',ways_updated=difference_ways,ways_old=old_ways,area=area,population=population,mobile=mobile,water=water,country=country, start_coord=start_coord, hospitals=hospitals, schools=schools, min_lon=min_lon, min_lat=min_lat, max_lat=max_lat, max_lon=max_lon)
示例#3
0
def hello():
	geojson = mf.get_map_by_name('Chitambo')	
	return json.dumps(geojson)