Exemple #1
0
def utility(utility, lat, long):
    nearest_utility = GIS.find_object((lat, long),
                                      utilities[utility]["data_name"],
                                      utilities[utility]["file"])
    direction = GIS.get_direction((lat, long), nearest_utility[0][1])
    current_location = GIS.get_human_readable_address(lat, long)
    return render_template("utility.html",
                           utility=utility,
                           current_location=current_location,
                           direction=direction)
Exemple #2
0
def ssh_check(ip):
    try:
        r = redis.StrictRedis(host='localhost', port=6379, db=0)
        import GIS
        GIS.GIS(ip)
        x = execute("ssh-keyscan {0}".format(ip)).read()
        r.set(name=ip, value=x)
        print x
        return x
    except KeyboardInterrupt:
        z = raw_input("Quit Scan [Y/N]: ")
        if "Yy" in z:
            Exit() and exit()
        if "Nn" in z:
            pass
Exemple #3
0
def json_show_Google_Maps(infile, map_title, html_file, map_zoom, map_type,
                          marker):
    """
    Reads radio network form JSON file and generates html file with nodes location.

    :param str infile: json file with network description
    :param str map_title: title of the map
    :param str html_file: html file name
    :param str map_zoom: google maps zoom parameter
    :param str map_type: type of the map: roadmap, satellite, hybrid, terrain
    :param str marker: type of marker: o, s, x, a, f; colour of marker: r, g, b, k

    :returns:
    """
    data = json.loads(open(infile).read())
    Network = data["nodes"]

    ant_ID = 0
    for node in Network:
        ant_ID += 1

        name = node["name"]
        # Remove all non-word characters (everything except numbers and letters)
        name = re.sub(r"[^\w\s]", '', name)
        # Replace all runs of whitespace with a single dash
        name = re.sub(r"\s+", '_', name)

        tmp = node["position"]
        pos = tmp["GPS"]
        lat = pos["lat"]
        lng = pos["lng"]
        alt = tmp["altitude"]

        if ant_ID == 1:
            map = GIS.google_map(map_title, html_file, [lat, lng], map_zoom,
                                 map_type)
        map.add_node(name, [lat, lng], [name], marker)

    return
def utility(utility, lat, long):
    nearest_utility = GIS.find_object((lat, long), utilities[utility]["data_name"], utilities[utility]["file"])
    direction = GIS.get_direction((lat, long), nearest_utility[0][1])
    current_location = GIS.get_human_readable_address(lat, long)
    return render_template("utility.html", utility=utility, current_location=current_location, direction=direction)
Exemple #5
0
import os
import sys
import string
import argparse

sys.path.insert(0, '../lib/')
from Parser import *
from Polygon import *
from Scatter import *
from Pie import *
from Bar import *
from GIS import *

if __name__ == '__main__':

    parse_GIS = Parser('../json/geojson.json')
    dict_gis = parse_GIS.load_json()

    point = GIS(dict_gis)
    point.init()
Exemple #6
0
def gis(arg):
	parse_GIS = Parser(args.input)
	dict_gis = parse_GIS.load_json()

	obj = GIS(dict_gis)
	obj.init()
Exemple #7
0
import GIS
import constants
from pprint import pprint

test = GIS.ArcOnline(client_id=constants.client_id,
                     client_secret=constants.client_secret)
test.get_code()
token = test.code
print(token)
org_id = test.get_org_id(token=token)
print(org_id)
#upload = test.uploadItem(userName="******",
#                         portalUrl="https://fcc",
#                         TPK=r"D:\FCC_GIS_Projects\21CompetitionReport\vector_tiles\Dec2017_any_coverage_nationwide.vtpk",
#                         itemID="64957bb6cbfd8464488fbf2c783c412d9",
#                         layerName="Dec2017_any_coverage_nationwide",
#                         token=token)
#print(upload)

#update = test.update_tiles(org_id,'Dec2017_any_coverage_nationwide',token)
#print(update)

# https://tiles.arcgis.com/tiles/YnOQrIGdN9JGtBh4/arcgis/rest/services/Dec2017_any_coverage_nationwide/VectorTileServer

user_response = test.search_user(user="******")

pprint(user_response)

import requests

url = "https://www.arcgis.com/sharing/rest/oauth2/token"
Exemple #8
0
import zmap
from ipwhois import IPWhois
import pprint
import json
ip_keys = zmap.redis_keys()
hash = file("hash.txt", 'r')
term = hash.read()
print "Searching for {}".format(term)
for ip in ip_keys:
    x = zmap.ip_get(ip)
    if term in x:
        spacer = "=" * 24
        print spacer
        print ip
        import GIS
        GIS.GIS(ip)
        print x
        print "Found Golden Key!"
        whois = IPWhois(ip)
        results = whois.lookup()
        print "And it belongs too: "
        pprint.pprint(results)
        print spacer
import requests
import constants
import GIS
from pprint import pprint

tester = GIS.ArcOnline()

folder_id = tester.query_by_folder_id_by_name("hello_world_1")

#pprint(folder_id)

#tester.create_folder("hello_world_1")
#tester.add_item_to_root_folder(in_file_path=r"D:\Census_Data\tl_2010_us_state10_wgs84\tl_2010_us_state10_wgs84.zip",
#                               title="tl_2010_states_wgs84",
#                               type='Shapefile',
#                               folder=folder_id)

#pprint(tester.list_folders_of_user())

#tester.upload_file(in_file_path=r"D:\Census_Data\tl_2010_us_state10_wgs84\tl_2010_us_state10_wgs84.zip",
#                   title="tl_2010_states_wgs84",
#                   type='Shapefile',
#                   folder="hello_world_1")

tester.items()
Exemple #10
0
umfrom arcgis.gis import GIS
from IPython.display import display

gis = GIS("https://python.playground.esri.com/portal", "arcgis_python", "amazing_arcgis_123")



wm_item = search_result[1]

from arcgis.mapping import WebMap
web_map_obj = WebMap(wm_item)
Exemple #11
0
	# Read the herds file.
	herds = []
	fp = open (args[0])
	fp.readline() # discard the header line
	for line in fp:
		size, lat, lon = line.split (',')[1:4]
		herds.append ((int(size), float(lat), float(lon)))
	fp.close()
	nherds = len (herds)

	# Get a bounding box around the herds.
	if srs != None:
		projection = GIS.projection[srs]
	else:
		projection = GIS.LinearProjection()
	coords = [projection.getCoords (lat, lon) for size, lat, lon in herds]
	xs = [x for x, y in coords]
	ys = [y for x, y in coords]
	minx = min(xs)
	maxx = max(xs)
	miny = min(ys)
	maxy = max(ys)
	pad = (PADDING - 1.0)/2 * max(maxx - minx, maxy - miny)
	minx -= pad
	maxx += pad
	miny -= pad
	maxy += pad
	bbox = GIS.adjustBox ((minx, miny, maxx, maxy), float(width) / height)

	# Make the background, either a blank image or a map, if requested.
Exemple #12
0
import os 
import sys 
import string
import argparse

sys.path.insert(0, '../lib/')
from Parser import *
from Polygon import *
from Scatter import *
from Pie import *
from Bar import *
from GIS import *


if __name__ == '__main__':
	
	parse_GIS = Parser('../json/geojson.json')
	dict_gis = parse_GIS.load_json()

	point = GIS(dict_gis)
	point.init()