Commit acb5bb2d authored by Bryson Howell's avatar Bryson Howell

Trying to get feature layers to query.

parent 1bf267c4
......@@ -44,7 +44,10 @@ def grab_features(anchor_point, extent, sample_dist = 10, case_name = 'blah', he
name_list = ['rivers_bdd', 'rivers', 'roads', 'lakes', 'powerlines', 'railroads', 'trails']
inac_layers = ['rivers_bdd', 'lakes']
gis = GIS(api_key="AAPKe7cb1ab4f2ba44748cf53ac4f30d0caavu5t_-uMdWP8SRjtoea3s66-cRyFZmMTNx4rqy2w5sjwegU_tbJyBesd0LCMmdtV") # linked Bryson's pro account
ky = "AAPKe7cb1ab4f2ba44748cf53ac4f30d0caavu5t_-uMdWP8SRjtoea3s66-cRyFZmMTNx4rqy2w5sjwegU_tbJyBesd0LCMmdtV"
tkn = "3NKHt6i2urmWtqOuugvr9ZEfiuh0-3Amg_JW92hWw6MrRjQKzJfjBbFhwGtOqYD3IEnYsljGDxUWTXa4b2HGR9WawiS9jXoVzqX7qF3-y5y3jPSTTL5TYKO8tHiitpqK"
gis = GIS(token=tkn,api_key=ky)
#gis = GIS(api_key="AAPKe7cb1ab4f2ba44748cf53ac4f30d0caavu5t_-uMdWP8SRjtoea3s66-cRyFZmMTNx4rqy2w5sjwegU_tbJyBesd0LCMmdtV") # linked Bryson's pro account
ap_meters = lat_lon2meters(anchor_point[0], anchor_point[1])
......@@ -75,6 +78,7 @@ def grab_features(anchor_point, extent, sample_dist = 10, case_name = 'blah', he
while type(q)==list and query_cnt <= 30: # have to do this because arcgis is sketchy as hell and doesnt always come back
try:
print("querying {} layer...".format(name_list[i]))
print(lyr)
query_starttime = time.time()
q = lyr.query(return_count_only=False, return_ids_only=False, return_geometry=True,
......
......@@ -68,6 +68,10 @@ def collect_terrain():
n_clusters = 10 #Number of areas to download
count_thres = 2 #Minimum number of points needed for a large download
#Parameters for feature_set
res = 25
folder = 'trust'
#Collection of map centers, in meters. Use to check if we need to download a new area
ipp_list = []
......@@ -156,12 +160,20 @@ def collect_terrain():
incidents.insert(0,'area',keys)
#Now, if there's only one key in an area we can avoid downloading a lot.
#Need to ouput data in a way that indicates if an IPP is a big area or not...
max_down = 1 #Maximum number of things to download
count = 0
do_plot = True
for i in range(0,len(ipp_list)):
print("Collecting GIS data %d/%d" % (i,len(ipp_list)))
#Download local map
if(keys.count(i) <= count_thres):
size = extent_test
else:
size = extent_download
if(count < max_down):
count = count + 1
grab_features(ipp_list[i], extent_download, sample_dist = res, case_name = folder, save_files = True, save_to_folder = True, file_id = str(count), plot_data=do_plot)
#For visualizing
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment