Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Dictionary For Incoming Tags
for n in n_list:
n_tags = n['tags'].keys()
for tag in n_tags:
if tag not in val_dict.keys():
val_dict[tag] = []
# Build Lists
for n in n_list:
try:
# Populate Tags
for tag in [key for key in val_dict.keys() if key != 'osm_id']:
val_dict[tag].append(str(n['tags'].get(tag, 'Null')))
# Populate Geometries & IDs
point = Point({
"x": n['lon'],
"y": n['lat'],
"spatialReference": {"wkid": 4326}
})
geo_dict['geo'].append(point)
val_dict['osm_id'].append(str(n['id']))
except Exception as ex:
print('Node ID {0} Raised Exception: {1}'.format(n['id'], str(ex)))
try:
return SpatialDataFrame(val_dict, geometry=geo_dict['geo'])
except TypeError:
raise Exception('Ensure ArcPy is Included in Python Interpreter')
def build_node_dict(n_list):
node_dict = {"ids": [], "names": [], "geoms": []}
for n in n_list:
try:
point = Point({
"x": n['lon'],
"y": n['lat'],
"spatialReference": {"wkid": 4326}
})
_name = 'Undefined'
tags = n.get("tags", None)
if tags:
name = tags.get("name", None)
if name:
_name = name
node_dict['ids'].append(str(n['id']))
node_dict['names'].append(_name)
node_dict['geoms'].append(point)