#!/usr/bin/env python # coding: utf-8 # Open in Colab # # Uncomment the following line to install [geemap](https://geemap.org) if needed. # In[ ]: # !pip install geemap # In[ ]: import geemap import json import os import requests from geemap import geojson_to_ee, ee_to_geojson from ipyleaflet import GeoJSON, Marker, MarkerCluster # In[ ]: geemap.show_youtube('4HycJPrwpuo') # In[ ]: Map = geemap.Map() Map # In[ ]: file_path = os.path.abspath('../data/us-cities.json') if not os.path.exists(file_path): url = 'https://github.com/giswqs/geemap/raw/master/examples/data/us-cities.json' r = requests.get(url) with open(file_path, 'w') as f: f.write(r.content.decode("utf-8")) with open(file_path) as f: json_data = json.load(f) # In[ ]: maker_cluster = MarkerCluster( markers=[Marker(location=feature['geometry']['coordinates'][::-1]) for feature in json_data['features']], name = 'Markers') # In[ ]: Map.add_layer(maker_cluster) # In[ ]: ee_fc = geojson_to_ee(json_data) Map.addLayer(ee_fc, {}, "US Cities EE")