<jupyter_start><jupyter_text>4 Get ROME all POI<jupyter_code>#find the center of every h3_code

ROME_geo_center_list = []

for i in ROME_h3_list:
    k = list(h3.h3_to_geo(i))
    ROME_geo_center_list.append(k)

ROME_geo_center_list_string = []

def make_string_geo():
    for i in ROME_geo_center_list:
        string = str(i[0]) + ',' + str(i[1])
        ROME_geo_center_list_string.append(string)
make_string_geo()
api_key= '<KEY>'
# url_range = f'https://browse.search.hereapi.com/v1/browse?at={GEO}&in=circle:{GEO};r=700&limit=100&apiKey={api_key}'

ROME_title_list = []
ROME_cat_id_list = []
ROME_cat_name_list = []
ROME_h3_source_list = []


count = 0

for index, GEO in enumerate(ROME_geo_center_list_string):
    resp = requests.get(url = f'https://browse.search.hereapi.com/v1/browse?at={GEO}&in=circle:{GEO};r=200&limit=100&apiKey={api_key}')
    data= resp.json()

    for i in data['items']:
        if 'categories' not in i:
            continue
        else:
            ROME_title_list.append(str(i['title']))
            ROME_cat_id_list.append(str(i['categories'][0]['id']))
            ROME_cat_name_list.append(str(i['categories'][0]['name']))
            ROME_h3_source_list.append(ROME_h3_list[index])
            count +=1
print('POI`s found: ' + str(count))
ROME_here_dict = { 'title': ROME_title_list, 
                'cat_id': ROME_cat_id_list, 
                'cat_name': ROME_cat_name_list, 
                'h3_source': ROME_h3_source_list} 
ROME_poi_df = pd.DataFrame(ROME_here_dict)
def make_cat_def(row):
    if row['cat_id'][:1] == '1':
        return 'Eat & Drink'
    elif row['cat_id'][:1] == '2':
        return 'Going Out-Entertainment'
    elif row['cat_id'][:1] == '3':
        return 'Sights and Museums'
    elif row['cat_id'][:1] == '4':
        return 'Transport'
    elif row['cat_id'][:1] == '5':
        return 'Accommodations'
    elif row['cat_id'][:1] == '6':
        return 'Shopping'
    elif row['cat_id'][:1] == '7':
        return 'Business and Services'
    elif row['cat_id'][:1] == '8':
        return 'Facilities'
    elif row['cat_id'][:1] == '9':
        return 'Areas and Buildings'
ROME_poi_df['cat_definition'] = ROME_poi_df.apply(lambda row : make_cat_def(row), axis=1)

ROME_poi_df = ROME_poi_df[[ 'h3_source',
                            'cat_definition', 
                            'cat_name',
                            'title'
                ]]
ROME_poi_df.to_csv('AMSTERDAM_poi_df.csv', sep=',')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1574740207833733, 'fraction_numerical': 0.019984012789768184, 'mean_word_length': 3.0567260940032415, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '49309', 'license': 'MIT', 'n_tokens_mistral': 989, 'n_tokens_neox': 963, 'n_words': 149, 'path': 'POI_MUC+PA/ROME+AMSTERDAM/get_amsterdam_h3.ipynb', 'repo_name': 'ND-Captstone-Magic/capstone_project', 'size': '2540'}