Author: Piconasha
Type: Tool Plugin
Version: 0.0.1
This plugin connects Dify to the Amap Open Platform, enabling AI applications to perform IP geolocation queries and walking route planning within China.
Query the geographical location of an IPv4 address (China only).
- Input: IPv4 address (optional - returns requester's location if empty)
- Output: Province and city information
Use Cases:
- User location detection
- Regional content personalization
- Security and fraud prevention
Plan walking routes between two coordinate points.
- Input: Starting point and destination coordinates (longitude, latitude)
- Output: Walking distance, duration, and step-by-step directions
Use Cases:
- Navigation assistance
- Travel planning
- Distance calculation
- Go to Plugins in your Dify workspace
- Search for "Amap" or "高德"
- Click Install
-
Clone this repository:
git clone https://github.com/piconasha/dify-plugin-amap.git cd dify-plugin-amap -
Package the plugin:
dify plugin package
-
Upload the
.difypkgfile to your Dify instance
- Visit Amap Open Platform
- Register/Login to your account
- Go to Console → Application Management → My Applications
- Create a new application and get your Key
- After installing the plugin, go to Plugin Settings
- Enter your Amap API Key in the credentials field
- Click Save
Tool Name: ip-query
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| ipv4_address | string | No | IPv4 address (e.g., 114.114.114.114). Leave empty to query requester's IP. |
Example:
Query: "Where is IP 114.114.114.114 located?"
Result: "IP 114.114.114.114 location: Jiangsu Nanjing"
Tool Name: direction_v2-walking
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| starting_point | string | Yes | Starting coordinates (longitude,latitude), e.g., 116.397428,39.90923 |
| ending_point | string | Yes | Destination coordinates (longitude,latitude), e.g., 116.481028,39.989643 |
Example:
Query: "Plan a walking route from Beijing Tiananmen (116.397428,39.90923) to Beijing Railway Station (116.427093,39.903738)"
Result:
Walking Route Planning Result
━━━━━━━━━━━━━━━━━━━━
Total Distance: 2.85 km (2850 m)
Estimated Time: 38 minutes
━━━━━━━━━━━━━━━━━━━━
Detailed Directions:
1. Walk 200m north along East Chang'an Avenue...
2. Turn right and walk 150m east...
...
This plugin uses the following Amap APIs:
| API | Endpoint | Documentation |
|---|---|---|
| IP Location | /v3/ip |
API Docs |
| Walking Route | /v5/direction/walking |
API Docs |
- IP Location: Only works for IP addresses within China
- Coordinates: Must use GCJ-02 coordinate system (China standard)
- Rate Limits: Subject to Amap API rate limits based on your account tier
This plugin sends the following data to Amap servers:
- API Key (for authentication)
- IP addresses (for geolocation queries)
- Geographic coordinates (for route planning)
For details, see PRIVACY.md.
- Python 3.12+
- Dify Plugin SDK
# Install dependencies
pip install -r requirements.txt
# Run locally
dify plugin devdify-plugin-amap/
├── manifest.yaml # Plugin manifest
├── provider/
│ ├── amap.py # Provider implementation
│ └── amap.yaml # Provider configuration
├── tools/
│ ├── ip/
│ │ ├── query.py # IP query tool
│ │ └── query.yaml # IP query configuration
│ └── direction_v2/
│ ├── walking.py # Walking route tool
│ └── walking.yaml # Walking route configuration
├── _assets/
│ ├── icon.svg # Light mode icon
│ └── icon-dark.svg # Dark mode icon
├── README.md # English documentation
├── readme/
│ └── README_zh_Hans.md # Chinese documentation
└── PRIVACY.md # Privacy policy
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Issues: GitHub Issues
- Amap API Support: Amap Developer Community
This project is licensed under the MIT License - see the LICENSE file for details.
- Dify - The AI application development platform
- Amap Open Platform - Location and map services