Interactive Map Code Generated in DeepSeek
Matt Sheehan
Demystifying the convergence of Geospatial, AI, and Spatial Computing ~ Unlocking geospatial's potential at Versar
Here is the code generated by DeepSeek to create an interactive map of the10 highest mountains in the world. Copy an paste this code into Google Colab. Here is a video which walks you through the process: https://www.youtube.com/watch?v=DK4EKMhPuV0
!pip install pydeck pandas
import pandas as pd
import pydeck as pdk
from google.colab import output
# Mountain data with coordinates and elevations
mountain_data = {
"Mountain": ["Mount Everest", "K2", "Kangchenjunga", "Lhotse", "Makalu",
"Cho Oyu", "Dhaulagiri I", "Manaslu", "Nanga Parbat", "Annapurna I"],
"Rank": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"Height_m": [8848, 8611, 8586, 8516, 8485, 8188, 8167, 8163, 8126, 8091],
"Country": ["Nepal/China", "Pakistan/China", "Nepal/India", "Nepal/China", "Nepal/China",
"Nepal/China", "Nepal", "Nepal", "Pakistan", "Nepal"],
"Latitude": [27.9881, 35.8808, 27.7025, 27.9617, 27.8892,
28.0941, 28.6967, 28.5497, 35.2372, 28.5956],
"Longitude": [86.9250, 76.5139, 88.1465, 86.9333, 87.0886,
86.6608, 83.4942, 84.5597, 74.5892, 83.8203],
"Color": [
[255, 99, 132, 220], # Everest Red
[54, 162, 235, 220], # K2 Blue
[255, 206, 86, 220], # Kangchenjunga Yellow
[75, 192, 192, 220], # Lhotse Teal
[153, 102, 255, 220], # Makalu Purple
[255, 159, 64, 220], # Cho Oyu Orange
[201, 203, 207, 220], # Dhaulagiri Silver
[50, 205, 50, 220], # Manaslu Green
[139, 69, 19, 220], # Nanga Parbat Brown
[255, 105, 180, 220] # Annapurna Pink
]
}
df = pd.DataFrame(mountain_data)
# Create layers
base_layer = pdk.Layer(
"TileLayer",
data=[],
get_tile_data="https://a.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png",
pickable=False
)
mountain_layer = pdk.Layer(
"ColumnLayer",
data=df,
get_position=["Longitude", "Latitude"],
get_elevation="Height_m",
elevation_scale=1,
radius=800, # Narrow columns (800 meters)
get_fill_color="Color",
pickable=True,
auto_highlight=True,
coverage=0.8,
extruded=True
)
# Configure view
view_state = pdk.ViewState(
领英推荐
latitude=28.0,
longitude=85.0,
zoom=5.2,
pitch=65,
bearing=-30,
max_zoom=18,
min_zoom=3
)
# Tooltip configuration
tooltip = {
"html": """
<div style="
padding: 8px;
background: rgba(25, 25, 25, 0.9);
color: white;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.3);
">
<div style="
border-left: 5px solid rgb{color};
padding-left: 8px;
margin-bottom: 4px;
">
<b style="font-size: 1.1em">{Mountain}</b>
</div>
<table style="margin: 3px 0; border-collapse: collapse;">
<tr><td>Rank</td><td style="padding-left: 12px">{Rank}</td></tr>
<tr><td>Height</td><td style="padding-left: 12px">{Height_m}m</td></tr>
<tr><td>Country</td><td style="padding-left: 12px">{Country}</td></tr>
</table>
</div>
""".replace("{color}", "{Color}"),
"style": {
"backgroundColor": "transparent",
"border": "none",
"fontFamily": "Arial, sans-serif"
}
}
# Create and display deck
deck = pdk.Deck(
layers=[base_layer, mountain_layer],
initial_view_state=view_state,
tooltip=tooltip,
map_style="light",
parameters={
"blending": "normal",
"antialiasing": True,
"precision": "highp"
}
)
# Enable Colab widget support
output.enable_custom_widget_manager()
deck
CaaS / Earth Monitoring (EM) and Geomatics / New Business Program Development
1 个月...some short cuts to more work, when the applications can actually deliver what I can do myself in 3-4 clicks... then it will be more valuable, and to a curiosity ... the whole language model business is rooted I the past... an object-oriented and fusion engine, now then we are talking ... literally ...