When visualizing national highway mileage across Chinese provinces in QGIS, I needed provincial capital markers without local data access. Using DeepSeek AI, I generated geographic layers directly in QGIS via Python scripting.
Visualization requiring provincial capitals
Methodology
1. Account Setup
Registered at DeepSeek and accessed the chat interface:
2. Prompt Engineering
Initial request:
"Provide coordinates for all Chinese provincial capitals and generate executable Python code for QGIS console display."
DeepSeek response included complete implementation:
python
Capital city coordinates dictionary
capital_cities = {
"北京": (116.4074, 39.9042),
"天津": (117.1994, 39.0851),
# ... (all 34 capitals)
}
Layer creation and styling
layer = QgsVectorLayer("Point?crs=EPSG:4326", "Provincial Capitals", "memory")
provider = layer.dataProvider()
provider.addAttributes([
QgsField("city", QVariant.String),
QgsField("longitude", QVariant.Double),
QgsField("latitude", QVariant.Double)
])
... (full implementation)
3. Execution
Copied code to QGIS Python Console:
Extended Functionality
Basemap Integration
Prompt:
"Generate code to load Tianditu satellite basemap in QGIS Python Console."
Solution (adjusted for working OSM alternative):
python
OSM Satellite Basemap
from qgis.core import QgsRasterLayer, QgsProject
osm_url = "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
osm_layer = QgsRasterLayer("type=xyz&url=" + osm_url, "OSM Satellite", "wms")
QgsProject.instance().addMapLayer(osm_layer)
Voronoi Polygons
Prompt:
"Generate Voronoi polygons from point layer in QGIS Python Console."
Gemini-provided implementation:
python
from qgis.core import *
from qgis.processing import *
point_layer = project.mapLayersByName("your_point_layer_name")[0]
params = {'INPUT': point_layer, 'OUTPUT': 'memory:'}
output_layer = processing.run('qgis:voronoipolygons', params)['OUTPUT']
project.addMapLayer(output_layer)
Performance Assessment
DeepSeek Advantages:
- Generated complete, executable QGIS solutions
- Understood complex GIS requirements
- Provided commented, structured code
Limitations:
- Server instability during peak times
- Restricted advanced processing prompts
- Tianditu implementation required debugging
This workflow demonstrates how AI assistants augment GIS workflows by rapidly generating executable geographic solutions without traditional data preparation.