高德地图 icon

高德地图

高德地图API,位置转换、定位等

Overview

This node integrates with a map service API to provide public transit route planning between two geographic points. It calculates optimal bus routes considering various parameters such as origin, destination, cities involved, date and time of travel, and user preferences for transit strategies (e.g., fastest route, least transfers). This is useful for applications that require detailed public transportation directions, such as travel planning apps, urban mobility services, or location-based services.

Practical examples:

  • A commuter app that suggests the best bus routes from home to work.
  • A city guide app providing public transit options for tourists.
  • An event app helping attendees find the best bus routes to the venue.

Properties

Name Meaning
出发点 (origin) Starting point coordinates in "longitude,latitude" format, e.g., "117.500244,40.417801". Decimal precision up to 6 places. Required.
目的地 (destination) Destination point coordinates in "longitude,latitude" format, e.g., "117.500244,40.417801". Decimal precision up to 6 places. Required.
城市/跨城规划时的起点城市 (city) City name or city code of the starting point for intra-city or inter-city bus route planning. Required.
跨城公交规划时的终点城市 (cityd) City name or city code of the destination city for inter-city bus route planning. Required.
选项 (options) Additional optional parameters:
- 是否计算夜班车 (nightflag): Whether to consider night buses (0 = no, 1 = yes).
- 出发日期 (date): Date of departure in yyyy-MM-dd format.
- 出发时间 (time): Time of departure in HH:mm 24-hour format.
- 公交换乘策略 (transit_strategy): Bus transfer strategy:
  0: Fastest mode
  1: Most economical
  2: Fewest transfers
  3: Least walking
  5: No subway
These options help customize the route planning according to user preferences.

Output

The node outputs JSON data containing detailed public transit route information between the specified origin and destination. The output typically includes:

  • Route segments with bus lines, stops, and transfer points.
  • Estimated travel times and distances.
  • Walking segments if applicable.
  • Additional metadata depending on the selected detail level.

No binary data output is expected.

Dependencies

  • Requires an API key credential for the map service provider.
  • The node depends on network access to the map service's routing API endpoint.
  • Proper configuration of the base URL and authentication credentials in n8n is necessary.

Troubleshooting

  • Invalid Coordinates: Ensure that the origin and destination coordinates are correctly formatted as "longitude,latitude" with up to 6 decimal places.
  • Missing Required Fields: The fields for origin, destination, city, and cityd must be provided; missing these will cause errors.
  • Unsupported City Codes: The city and cityd values must correspond to supported city names or codes by the map service.
  • Date and Time Format Errors: If specifying date and time, use the exact formats "yyyy-MM-dd" and "HH:mm" respectively.
  • API Key Issues: Invalid or missing API keys will result in authentication errors.
  • Network Errors: Check connectivity and ensure the base URL is correctly configured.

Common error messages usually relate to invalid parameters or authentication failures. Verify all inputs and credentials accordingly.

Links and References

Discussion