Esempio n. 1
0
    def __init__(self, title, html_file, map_center, map_zoom, map_type):
        self.title = title
        self.html_file = html_file
        self.map_center = map_center
        self.map_zoom = map_zoom
        self.map_type = map_type
        self.node_Ids = []
        self.html = []

        path = os.getcwd()
        for i in range(0, 3):
            [path, tail] = os.path.split(path)

        projDir = iniProject.iniDir(path)
        html_template_file = os.path.join(projDir["template"], "google_map_template.html")
        with open(html_template_file, "r") as myfile:
            self.html = myfile.readlines()

        if (str(map_type) in iniProject.Google_Map_Types):
            pass
        else:
            map_type = "roadmap"

        map_type = "'" + str(map_type) + "'"
        out_html_string = []
        for x in self.html:
            y = x.replace("$map_center$", "lat:" + str(map_center[0]) + ", lng:" + str(map_center[1]))
            x = y.replace("$map_zoom$", str(map_zoom))
            y = x.replace("$map_type$", str(map_type))
            x = y.replace("$title$", str(self.title))
            out_html_string.append(x)

        self.html = []
        for x in out_html_string:
            self.html.append(x)

        with open(self.html_file, "w") as myfile:
            myfile.writelines(self.html)
        return
Esempio n. 2
0
#csv_anchors = "Log-a-Tec_2_JSI.csv"         # all nodes in in Log-a-tec 2
csv_anchors = "Log-a-Tec_2_JSI - 4A.csv"  # only 4 node in Log-a-tec

Agents_Size = 10  # number of Agents/refAgents in network
delta_RSSI = 1.0  # precision of RSSI measurement  in dBm
plot_net = True  # plot the network in jpg file
plot_net_file = "Network.jpg"  # name of experimental jpg file
plot_html = True  # plot in html file
plot_html_file = "Network.html"  # html file

hist_plot = False  # plot histogram
if Agents_Size == 1:  # do not plot histogram for only one test
    hist_plot = False

# Setting project dir, results dir, plot files
projDir = iniProject.iniDir(iniProject.get_proj_dir(3))
plot_net_file = os.path.join(projDir["results"], plot_net_file)
plot_html_file = os.path.join(projDir["results"], plot_html_file)

# Load anchor nodes from csv file
csv_anchors = os.path.join(projDir["csv"], csv_anchors)
Anchors = REM_Network.RadioNetwork("Anchors")
Anchors.read_fromCsvFile(csv_anchors)
IJS_Outdoor.append("Network", "Anchors", Anchors)
del projDir, csv_anchors

# SetUp region map based on radio Anchor nodes
Region = Anchors.get_Region_Map(0.10)
IJS_Outdoor.set_Region(Region)
del Anchors
Esempio n. 3
0
            map = GIS.google_map(map_title, html_file, [lat, lng], map_zoom,
                                 map_type)
        map.add_node(name, [lat, lng], [name], marker)

    return


if __name__ == '__main__':
    print "\n***********************************"
    print "*  JSON read/parse files test     *"
    print "*************************************\n"

    path = os.getcwd()
    for i in range(0, 3):
        [path, tail] = os.path.split(path)
    projDir = iniProject.iniDir(path)

    infile = "Log-a-Tec_2_JSI.json"
    outfile = "Log-a-Tec_2_JSI.csv"

    infile = os.path.join(projDir["json"], infile)
    outfile = os.path.join(projDir["csv"], outfile)

    json_show_Google_Maps(infile, "LOG-a-TEC-IJS", "bla.html", 20, "road", "x")

    radius = "10"
    chan_param = "ITUR1546-4,rural,50,,,,,,,,,"

    num_cells = json_to_RaPlaTcsv(infile, outfile, radius, chan_param)
    print "Number of cells added in file: ", num_cells