display points with longitude and latitude on a map, and show point names using geemap in colab
时间: 2024-04-14 19:29:39 浏览: 80
Sure! To display points with longitude and latitude on a map and show point names using `geemap` library in Colab, you can follow the steps below:
1. Install `geemap` library by running the following command:
```python
!pip install geemap
```
2. Import the necessary libraries:
```python
import geemap.eefolium as geemap
import ee
```
3. Initialize Earth Engine:
```python
ee.Initialize()
```
4. Create a list of point coordinates (longitude, latitude) and point names:
```python
points = [
{"name": "Point A", "longitude": -122.084, "latitude": 37.422},
{"name": "Point B", "longitude": -122.081, "latitude": 37.426},
{"name": "Point C", "longitude": -122.083, "latitude": 37.421}
]
```
5. Create a map using `geemap`:
```python
Map = geemap.Map(center=[37.422, -122.084], zoom=13)
```
6. Iterate through the points list and add markers to the map:
```python
for point in points:
name = point["name"]
lon = point["longitude"]
lat = point["latitude"]
marker = geemap.Marker(location=[lat, lon], draggable=False)
marker.add_child(geemap.Tooltip(name))
Map.add_layer(marker)
```
7. Display the map:
```python
Map
```
By running the above code in Colab, you should be able to see a map with markers at the specified points, and the point names will be displayed when you hover over the markers.
阅读全文