The ArcGIS Location Services are services hosted by Esri that provide geospatial functionality and data for building mapping applications. You can use the service APIs to display maps, access basemaps styles, visualize data, find places, geocode addresses, find optimized routes, enrich data, and perform other mapping operations. The services also support advanced routing operations such as fleet routing, calculating service areas, and solving location-allocation problems. To build applications you can use ArcGIS Maps SDKs, open source libraries, and scripting APIs.

This process also can be replicated if users have [ArcGIS Enterprise] (https://enterprise.arcgis.com/en/)

A service area, also known as an isochrone, is a polygon that represents the distance that can be reached when driving or walking on a street network. This type of analysis is common in real estate search or determining the driving proximity to schools, businesses, or other facilities. For example, you can create a drive time polygon that represents how far you can drive in any direction from the center of a city in 20 minutes.

You can use service areas to build applications that:

What You Will Learn

In this Quickstart you will be go over the steps of calculating servicearea/isochrones using the ArcGIS Location Services. You will also be visualizing them using ArcGIS Pro. ServiceArea

What You Will Build

Solution

  1. Develop a Snowpark UDF which invokves the ArcGIS ServiceArea service function and stores the response back into the source table.
  2. Develop a Snowpark UDF which extracts and converts the geometry from ArcGIS reponse into Geojson co-ordinates.
  3. Connect and visualize the service areas / isochrones using ArcGIS Pro.

What You will Need

Prerequisites

Skills

It is assumed that you have the following skills:

(Optional) Create ArcGIS account

This tutorial requires ArcGIS account, preferrably with appropriate privileges to create API key and optionally to connect via ArcGIS pro. If you do not have those privileges or wish to create one, you can sign up for an ArcGIS Online Trial account.

Create an API Key

You will be invoking API services in ArcGIS, using Snowpark UDF. For this, you will need to create an API key with appropriate privileges as found in the documentation: Create API key credentials.

Keep the API key saved in a secure location. You will need it in the folowing steps.

Configure ArcGIS Pro and Snowflake connectivity

You will be visualizing the service area using ArcGIS Pro. To do that, you will need to connect to your Snowflake account from ArcGIS Pro.

Follow the instructions in the documentation: Connect to Snowflake from ArcGIS.

Create Database and assets

In this step, you will create a new database, schema, and warehouse to store the data and run the queries.

NOTE: To keep it simple, we will using the accountadmin by default. But in real world, you should be using a custom role with the appropriate privileges.

Open up a new SQL worksheet and run the following commands. To open up a new SQL worksheet, select Projects » Worksheets, then click the blue plus button and select SQL worksheet.

use role accountadmin;

-- you can create the warehouse as below or use any
-- existing warehouse that you have access to.
create warehouse if not exists compute_wh
  warehouse_type = standard
  warehouse_size = xsmall
  auto_suspend = 600
  auto_resume = true
  initially_suspended = true
  ;

create database if not exists arcgis_db;

-- a default schema 'public' is created by default when a database is created.

Importing and running the notebook

The codebase needed for the quickstart is available in the notebook. You will need to import it into your Snowflake account as follows:

  1. Download the notebook: ARCGIS_SERVICEAREA.ipynb.Download the file by clicking on the Download raw file from the top right. importing notebook
  2. On your Snowflake web interface, Snowsight, Navigate to Project > Notebooks from the left menu bar.
  3. Click the notebook button on the top right and select Import from .ipynb from the dropdown.
  4. Select the downloaded notebook file from your local directory and press Open.
  5. A Create Notebook dialog will show up. Select database, schema, and warehouse for the Notebook and click Create. Create Notebook
  6. Add packages to the notebook. You need to add the following packages:
    1. pydeck add packages
  7. Update the variables in the cell ‘initialization'. update variables
  8. Start the notebook session by clicking ‘Start'. and wait for the status to change to ‘Active'.
  9. Run the notebook cells, by clicking ‘Run all'.

Solution execution

Once all the cell has been executed successfully, you will see the following objects in the database.

The notebook also creates an quick visualization of the service area also:

In this step, you will be connecting to your Snowflake account from ArcGIS Pro and visualize the service areas.

  1. Open ArcGIS Pro, on your laptop and Create a new project
  2. Add a new map.
  3. Create a Snowflake connection, ensure database and role are set correctly.
  4. Add the view ' vw_warehouses_serviceareas_serviceareas_feature' to the map.
  1. Repeat the process to add the view ‘vw_warehouses_serviceareas_address_feature' to the map. This feature is to display the warehouse address location hence the Geometry Type is ‘Point'. The Symbology need not be updated.

Once you have added the features to the map, you will see the service area and the warehouse location as shown below:

Having gone over the tutorial, you now have seen how to communicate with ArcGIS Location services and enrich your data.

Snowflake provides powerful solutions when you bring Snowflake's advanced analytics, a rich set of geospatial functions, Cortex (Generative AI), Snowpark and Streamlit's visualization capabilities together. With a rich dataset of marketplace providers, and the ability to enrich and derive insights on your data and new use case is easier.

What You Learned

Related Resources