0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

Calculate → Calculate Distance

AI-generated

Overview

The node provides a utility to calculate the geographical distance between two locations. It supports different modes of transportation such as walking, driving, bicycling, and transit, allowing users to estimate travel distances based on real-world routing rather than simple straight-line calculations. This is useful in scenarios like logistics planning, travel time estimation, delivery route optimization, or any workflow requiring distance-based decision making.

For example, a user can input "Berlin, Germany" as the starting location and "Hamburg, Germany" as the ending location, select "driving" mode, and get the driving distance between these cities. Alternatively, coordinates can be used instead of addresses.

Properties

Name Meaning
Starting Location The starting point for the distance calculation. Can be an address (e.g., city name) or coordinates in latitude,longitude format.
Ending Location The destination point for the distance calculation. Also accepts an address or coordinates.
Mode The mode of transportation to use for calculating the distance. Options: Walking, Driving, Bicycling, Transit.

Output

The node outputs JSON data containing the calculated distance information between the specified start and end points according to the selected mode of transport. The exact structure is not detailed in the source code snippet, but typically it would include fields such as:

  • Distance value (e.g., in kilometers or miles)
  • Estimated travel time
  • Possibly route details or summary

No binary data output is indicated.

Dependencies

  • Requires an API key credential for authentication with the external service at https://prod.0codekit.com.
  • The node sends a POST request to the endpoint /calculate/geodistance-v2 with the parameters startPoint, endPoint, and mode.
  • Proper network access and valid credentials are necessary for successful operation.

Troubleshooting

  • Invalid Location Format: If the starting or ending location is not recognized (wrong address or malformed coordinates), the API may return an error or no results. Ensure inputs are correctly formatted.
  • Authentication Errors: Missing or invalid API key will cause authentication failures. Verify that the API key credential is configured properly.
  • Unsupported Mode: Selecting a mode outside the provided options might cause errors; only walking, driving, bicycling, and transit are supported.
  • Network Issues: Connectivity problems to the external API endpoint will prevent distance calculation.
  • Empty Results: If locations are too far apart or unreachable by the selected mode, the response might be empty or indicate no route found.

Links and References

  • No direct links provided in the source code.
  • For more information about geodistance calculations and modes of transport, consider referencing mapping services documentation such as Google Maps Distance Matrix API or similar services.

Discussion