Nextbillion.ai Snowflake Native App
This application provides wrappers for NextBillion.ai geospatial APIs in the form of Stored Procedures, designed to be used within the Snowflake environment.
Table of Contents
Introduction
The NextBillion.ai Snowflake application ships wrappers for geospatial APIs, offering seamless integration of geocoding, routing, and isochrone functionalities via Stored Procedures. The stored procedures require inputs such as table_name
, query_column
, and result_column
to operate within the Snowflake environment.
Usage Instructions and Installation
API Key Requirement
To run the stored procedures, you will need an API key. Please contact [email protected] or [email protected] to obtain your key.
Configuration
After installing the app, follow these steps to configure your connection settings and API key :
- Review Connection Settings
- Navigate to Security > Connections.
- Go to Connections and click Review.
- View the allowed endpoints set to
api.nextbillion.io
- Click Connect to finalize the connection.
- Enter the API Key
- Navigate to Security > Connections.
- Go to Credentials and click Configure.
- Enter your API key in the provided field.
- Click Configure to save your changes.
Call Init APP
After connection is reviewed and API key is configured properly, call init_app() stored procedure.
Example:
Grant Access To Consumer Tables
To allow the NextBillion.ai application access to certain databases, schemas, and tables within your Snowflake account, grant the required permissions. Ensure the prefix app_nb
represents your installed application (replace it with the actual app name in your environment if it differs).
Example:
Supported APIs
Directions (Fast) API
The Directions (Fast) API calculates the distance and duration of travel between two geographic points. It returns a JSON object with the calculated distance and estimated travel time.
Stored Procedure:
Return Value:
On success: {"distance": distance, "duration": duration}
For more details about the API, refer to the NextBillion.ai API documentation.
Example:
Forward Geocode API
The Forward Geocode API converts an address or location into geographic coordinates (latitude and longitude).
Stored Procedure:
IN_COLUMN Details:
This parameter allows restricting the search within specific geographic areas. Examples include:
in=countryCode:CAN,MEX,USA
to search within specific countries.in=circle:52.53,13.38;r=10000
to search within a 10,000-meter radius of a central point.in=bbox:13.08836,52.33812,13.761,52.6755
to search within a bounding box.
Return Value:
On success: {"lat": latitude, "lng": longitude}
For more details about the API, refer to the NextBillion.ai API documentation.
Example:
Reverse Geocode API
The Reverse Geocode API converts geographic coordinates into a human-readable address.
Stored Procedure:
Return Value:
On success: Address string
For more details about the API, refer to the NextBillion.ai API documentation.
Example:
Isochrone API
The Isochrone API generates a polygon representing areas reachable within a specified distance or time from a central point.
Stored Procedure:
Return Value:
On success: GeoJSON Polygon or Linestring
For more details about the API, refer to the NextBillion.ai API documentation.
Example: