In follow-up to our tutorial on Creating Dynamic Marathon Route Visualizations with MapPlus: A No-Code GIS Solution, we compiled a comprehensive dataset of Chinese marathons through automated data processing. This article documents the methodology and technical implementation.
Marathon distribution heatmap in QGIS
Data Sources
Official platform:
China Marathon Website: https://www.runchina.org.cn/
Workflow
Step 1: Race Calendar Scraping
Extracted all race events from the official calendar:
Output: events.json
Step 2: Geocoding Locations
Implemented reverse geocoding for spatial analysis:
- Used Tianditu Geocoding API
- Required developer registration: http://lbs.tianditu.gov.cn/home.html
API Endpoint:
http://api.tianditu.gov.cn/geocoder?ds={"keyWord":"Address"}&tk=YOUR_API_KEY
- Daily quota: 7,000 requests (free tier)
- Added latitude/longitude to
events.json
Step 3: JSON to CSV Conversion
Employed Node.js json2csv
package for tabular output
Implementation Code
Complete Node.js solution:
Execution Guide
Install dependencies:
yarn install # or npm install
Run sequential processing:
node index.js # Scrape initial data node generateGeoCode.js # Geocode locations (edit API key) node json2csv.js # Generate final CSV
System Requirements
- Node.js v18+
- Tianditu developer account
- Basic command-line proficiency
Technical support available via comments section.
Geospatial Insight: The dataset reveals marathon distribution patterns across China, with higher concentration in eastern regions and seasonal clustering in spring/autumn months.