주요 컨텐츠로 이동

Databricks의 ArcGIS GeoAnalytics Engine

데이터 과학 워크플로우에서의 확장 가능한 지리공간 분석

ArcGIS GeoAnalytics Engine in Databricks

발행일: 2022년 12월 7일

솔루션9 min read

This is a collaborative post from Esri and Databricks. We thank Senior Solution Engineer Arif Masrur, Ph.D. at Esri for his contributions.

 

Advances in big data have enabled organizations across all industries to address critical scientific, societal, and business issues. Big data infrastructure development assists data analysts, engineers, and scientists address the core challenges of working with big data - volume, velocity, veracity, value, and variety. However, processing and analyzing massive geospatial data presents its own set of challenges. Every day, hundreds of exabytes of location-aware data are generated. These data sets contain a wide range of connections and complex relationships between real-world entities, necessitating advanced tooling capable of effectively binding these multifaceted relationships through optimized operations such as spatial and spatiotemporal joins. The numerous geospatial formats that must be ingested, verified and standardized for efficient scaled analysis add to the complexity.

Some of the difficulties of working with geographical data are addressed by the recently announced support for built-in H3 expressions in Databricks. However, there are many geospatial use cases, some of which are more complex or centered on geometry rather than grid indices. Users can work with a range of tools and libraries on the Databricks platform while taking advantage of numerous Lakehouse capabilities.

Esri, the world's leading GIS software vendor, offers a comprehensive set of tools, including ArcGIS Enterprise, ArcGIS Pro, and ArcGIS Online, to solve the aforementioned geo-analytics challenges. Organizations and data practitioners using Databricks need access to tools where they do their day-to-day work outside of the ArcGIS environment. This is why we are excited to announce the first release of ArcGIS GeoAnalytics Engine (hereafter called GA Engine), which allows data scientists, engineers, and analysts to analyze their geospatial data within their existing big data analysis environments. Specifically, this engine is a plugin for Apache Spark™ that extends data frames with very fast spatial processing and analytics, ready to run in Databricks.

Benefits of the ArcGIS GeoAnalytics Engine

Esri's GA Engine allows data scientists to access geoanalytical functions and tools within their Databricks environment. The key features of GA Engine are:

  • 120+ spatial SQL functions—Create geometries, test spatial relationships, and more using Python or SQL syntax
  • Powerful analysis tools—Run common spatiotemporal and statistical analysis workflows with only a few lines of code
  • Automatic spatial indexing—Perform optimized spatial joins and other operations immediately
  • Interoperability with common GIS data sources —Load and save data from shapefiles, feature services, and vector tiles
  • Cloud-native and Spark-native—Tested and ready to install on Databricks
  • Easy to use—Build spatially-enabled big data pipelines with an intuitive Python API that extends PySpark

SQL functions and analysis tools
Currently GA Engine provides 120+ SQL functions and 15+ spatial analysis tools that support advanced spatial and spatiotemporal analysis. Essentially, GA Engine functions extend the Spark SQL API by enabling spatial queries on DataFrame columns. These functions can be called with Python functions or in a PySpark SQL query statement and enable creating geometries, operating on geometries, evaluating spatial relationships, summarizing geometries, and more. In contrast to SQL functions which operate on a row-by-row basis using one or two columns, GA Engine tools are aware of all columns in a DataFrame and use all rows to compute a result if required. These wide arrays of analysis tools enable you to manage, enrich, summarize, or analyze entire datasets.

  • Aggregate Points
  • Calculate Density
  • Find Hotspots
  • Find Point Clusters
  • Geographically Weighted Regression (GWR)
  • Detect Incidents
  • Find Dwells
  • Find Similar
  • Calculate Field
  • Clip
  • Overlay
  • Spatiotemporal Join
  • Reconstruct Tracks
  • Summarize Within
  • Trace Proximity Events
  • Calculate Motion Statistics
  • Group By Proximity

The GA Engine is a powerful analytical tool. Not to be overshadowed, though, is how easy the GA Engine makes working with common GIS formats. The GA Engine documentation includes multiple tutorials for reading and writing to and from Shapefiles and Feature Services. The ability to process geospatial data using GIS formats provides great interoperability between Databricks and Esri products.

Databricks and ArcGIS: Interoperability & Analysis with GeoAnalytics Engine
Databricks and ArcGIS: Interoperability & Analysis with GeoAnalytics Engine

GA engine for different use cases

Let's go over a few use scenarios from various industries to show how the ESRI's GA Engine handles large amounts of spatial data. Support for scalable spatial and spatiotemporal analysis is intended to assist any company in making critical decisions. In three diverse data analytics domains—mobility, consumer transaction, and public service—we will concentrate on revealing geographical insights.

Mobility data analytics

Mobility data is constantly growing and can be divided into two categories: human movement and vehicle movement. Human mobility data collected from smartphone users in mobile phone service areas provide a more in-depth look at human activity patterns. Millions of connected vehicles' movement data provide rich real-time information on directional traffic volumes, traffic flows, average speeds, congestion, and more. These data sets are typically large (billions of records) and complex (hundreds of attributes). These data require spatial and spatiotemporal analysis that goes beyond basic spatial analysis, with immediate access to advanced statistical tools and specialized geoanalytics functions.

Let's start by looking at an example of analyzing human movement based on Cell Analytics™ data from Esri partner Ookla®. Ookla® collects big data on global wireless service performance, coverage, and signal measurements based on the Speedtest® application. The data includes information about the source device, mobile network connectivity, location, and timestamp. In this case, we worked with a subset of data containing approximately 16 billion records. With tools not optimized for parallel operations in Apache Spark(™), reading this high-volume data and enabling it for spatiotemporal operations could incur hours of processing time. Using a single line of code with GeoAnalytics Engine, this data can be ingested from parquet files in a few seconds.

To start deriving actionable insights, we'll dive into the data with a simple question: What is the spatial pattern of mobile devices over the conterminous United States? This will allow us to begin characterizing human presence and activity. The FindHotSpots tool can be used to identify statistically significant spatial clusters of high values (hot spots) and low values (cold spots).

Fig 1. Representation of Input and Output of FindHotSpots tool that identifies statistically significant hot spots and cold spots using the Getis-Ord Gi* statistic
Fig 1. Representation of Input and Output of FindHotSpots tool that identifies statistically significant hot spots and cold spots using the Getis-Ord Gi* statistic

결과로 나온 핫스팟 데이터프레임은 Matplotlib을 사용하여 시각화하고 스타일을 지정했습니다(그림 2). 이 데이터는 미국 본토에서 장치 연결 기록(빨간색)이 연결된 장치의 밀도가 낮은 위치(파란색)에 비해 많다는 것을 보여주었습니다. 예상대로 주요 도시 지역에서 연결된 장치의 밀도가 더 높게 나타났습니다.

그림 2. 미국 본토의 모바일 장치 관측 핫스팟
그림 2. 미국 본토의 모바일 장치 관측 핫스팟

다음으로, 미국 전역에서 모바일 네트워크 신호 강도가 균일한 패턴을 따르는지 질문했습니다. 이 질문에 답하기 위해 AggregatePoints 도구를 사용하여 장치 관측치를 육각형 빈으로 요약하여 특히 강력하거나 약한 셀룰러 서비스 영역을 식별했습니다(그림 3). 모바일 네트워크 신호 강도를 측정하는 데 사용되는 값인 rsrp(기준 신호 수신 전력)를 사용하여 15km 빈에 대한 평균 통계를 계산했습니다. 이 분석은 셀룰러 서비스 신호 강도가 일관되지 않으며, 주요 도로망과 도시 지역을 따라 더 강한 경향이 있음을 보여주었습니다.

st_plotting을 사용하여 결과를 플로팅하는 것 외에도 arcgis 모듈을 사용하고 결과 데이터프레임을 ArcGIS Online에 피처 레이어로 게시했으며 지도 기반의 대화형 시각화를 만들었습니다.

그림 3. 미국 본토의 모바일 장치 신호 강도 공간 패턴을 표시하는 대화형 ArcGIS 웹 앱
그림 3. 미국 본토의 모바일 장치 신호 강도 공간 패턴을 표시하는 대화형 ArcGIS 웹 앱

이제 모바일 장치의 광범위한 공간 패턴을 이해했으므로, 사람들의 활동 패턴에 대해 더 깊이 이해하려면 어떻게 해야 할까요? 사람들은 어디에서 시간을 보낼까요? 이 질문에 답하기 위해 FindDwellLocations를 사용하여 2019년 5월 31일(금요일)에 덴버, 콜로라도에 있는 장치에서 동일한 일반 위치에 5분 이상 머문 장치를 찾았습니다. 이 분석은 일반적인 이동 활동과 구별되는, 더 오래 지속되는 활동이 있는 위치, 즉 소비자 목적지를 이해하는 데 도움이 될 수 있습니다.

result_dwell 데이터프레임은 다양한 위치에 머문 장치 또는 개인에 대한 정보를 제공합니다. 그림 4의 체류 시간 히트맵은 덴버 주변에서 사람들이 시간을 보내는 곳에 대한 개요를 제공합니다.

그림 4. 2019년 5월 31일 덴버, 콜로라도 주변의 체류 시간 히트맵
그림 4. 2019년 5월 31일 덴버, 콜로라도 주변의 체류 시간 히트맵

또한 더 오래 머무는 장소를 탐색하고 싶었습니다. 이를 위해 Overlay를 사용하여 SafeGraph Geometry 데이터의 관심 지점(POI) 발자국 중 2019년 5월 31일에 체류 위치(result_dwell 데이터프레임에서)와 교차하는 지점을 식별했습니다. groupBy 함수를 사용하여 상위 POI 범주별로 연결된 장치의 체류 시간을 계산했습니다. 그림 5는 사무용품, 문구 및 선물 가게, 무역 계약업체 사무실을 포함한 일부 도시 POI가 더 긴 체류 시간과 일치했음을 강조합니다.

그림 5. 2019년 5월 31일 덴버의 SafeGraph 관심 지점 범주별 총 체류 시간
그림 5. 2019년 5월 31일 덴버의 SafeGraph 관심 지점 범주별 총 체류 시간

Cell AnalyticsTM 데이터를 사용한 이 샘플 분석 워크플로는 사람들의 활동을 더 구체적으로 특성화하기 위해 적용하거나 재활용할 수 있습니다. 예를 들어, 소매점 주변의 소비자 행동에 대한 통찰력을 얻기 위해 데이터를 활용할 수 있습니다. 월마트나 코스트코에서 쇼핑한 후 어떤 레스토랑이나 커피숍을 방문했을까요? 또한 이러한 데이터셋은 팬데믹 및 자연 재해 관리에 유용할 수 있습니다. 예를 들어, 팬데믹 기간 동안 사람들이 공중 보건 비상 지침을 따랐을까요? 어떤 도시 지역이 다음 COVID-19 또는 산불로 인한 대기 질 악화 핫스팟이 될 수 있을까요? 더 넓은 지리적 규모에서 소득 불평등으로 인한 인간 이동성 및 활동의 격차를 볼 수 있을까요?

Transaction data analytics

관심 지점에 대한 집계된 거래 데이터에는 특정 위치에서 사람들이 어떻게, 언제 돈을 쓰는지에 대한 풍부한 정보가 포함되어 있습니다. 이러한 데이터의 엄청난 양과 속도는 소비자 지출 행동을 명확하게 이해하기 위해 고급 공간 분석 도구를 필요로 합니다: 지리별로 소비자 행동이 어떻게 다를까요? 수익을 창출하기 위해 어떤 비즈니스가 함께 입지하는 경향이 있을까요? 물리적 매장(예: 월마트)에서 소비자는 어떤 상품을 구매하고 온라인에서 구매하는 상품은 무엇일까요? COVID-19와 같은 극한 상황에서 소비자 행동이 변할까요?

이러한 질문은 SafeGraph Spend 데이터와 GeoAnalytics Engine을 사용하여 답할 수 있습니다. 예를 들어, 2020년과 2021년의 전국 SafeGraph Spend 데이터를 분석하여 미국에서 COVID-19 기간 동안 사람들의 이동 패턴이 어떻게 영향을 받았는지 파악하고 싶었습니다. 아래에서는 미국 카운티별로 집계된 소비자별 연간 지출(USD)을 보여줍니다. 데이터프레임을 ArcGIS Online에 게시한 후 ArcGIS Web AppBuilder의 Swipe 위젯을 사용하여 대화형 지도를 만들어 시간 경과에 따른 변화를 보인 카운티를 빠르게 탐색했습니다(그림 6).

Fig 6. 2020년과 2021년 팬데믹 기간 동안 카운티 수준에서 집계된 지출(USD)을 보여주는 렌터카 지출 패턴 대시보드
Fig 6. 2020년과 2021년 팬데믹 기간 동안 카운티 수준에서 집계된 지출(USD)을 보여주는 렌터카 지출 패턴 대시보드

다음으로, 연간 온라인 지출이 가장 많은 미국 카운티와 인구 및 농산물 판매 패턴의 유사성을 고려하여 유사한 온라인 쇼핑 지출 패턴을 가진 다른 카운티를 탐색했습니다. 지출 DataFrame의 속성 필터링을 기반으로 2020년에 새크라멘토가 온라인 쇼핑 지출에서 최고 순위를 차지했음을 확인했습니다. 유사한 지역을 찾기 위해 FindSimilarLocations 도구를 사용하여 온라인 쇼핑 및 지출 측면에서 새크라멘토와 가장 유사하거나 다른 카운티를 식별했습니다. 이는 인구 및 농업(총 경작지 면적 및 농산물 평균 판매량)과의 유사성을 기준으로 합니다(그림 7).

Fig 7. 인구, 농업 및 온라인 쇼핑 행동 측면에서 새크라멘토와 가장 유사한 미국 카운티
Fig 7. 인구, 농업 및 온라인 쇼핑 행동 측면에서 새크라멘토와 가장 유사한 미국 카운티

공공 서비스 데이터 분석

311 민원 기록과 같은 공공 서비스 데이터셋에는 주민들에게 제공되는 비응급 서비스에 대한 귀중한 정보가 포함되어 있습니다. 이 데이터에서 시공간 패턴을 시기적절하게 모니터링하고 식별하면 지방 정부가 효율적인 311 민원 처리를 위한 리소스를 계획하고 할당하는 데 도움이 될 수 있습니다.

이 예시에서는 2010년부터 2022년 2월까지의 뉴욕 311 서비스 요청 약 2,700만 건의 데이터를 신속하게 읽고, 처리/정제하고, 필터링한 다음, 뉴욕시 지역에 대해 다음 질문에 답하는 것을 목표로 했습니다.

  • 평균 311 응답 시간이 가장 긴 지역은 어디인가요?
  • 평균 응답 시간이 긴 불만 유형에 패턴이 있나요?

첫 번째 질문에 답하기 위해 응답 시간이 가장 긴 민원을 식별했습니다. 다음으로, 데이터를 필터링하여 평균 시간보다 3 표준편차 더 긴 기록을 포함했습니다.

두 번째 질문인 중요한 민원 그룹 찾기에 답하기 위해 GroupByProximity 도구를 활용하여 500피트 및 5일 이내에 발생한 동일 유형의 민원을 찾았습니다. 그런 다음 10개 이상의 기록이 있는 그룹을 필터링하고 각 민원 그룹에 대한 볼록 헐(convex hull)을 생성했습니다. 이는 시공간 패턴 시각화에 유용할 것입니다(그림 8). ArcGIS GeoAnalytics Engine에 포함된 경량 플로팅 메서드인 st.plot()을 사용하면 DataFrame에 저장된 지오메트리를 즉시 볼 수 있습니다.

Fig 8. Visualizing spatial distributions of 311-call complaint types in New York City using st.plot() method
Fig 8. Visualizing spatial distributions of 311-call complaint types in New York City using st.plot() method

이 지도를 통해 뉴욕시의 다양한 민원 유형별 공간 분포를 쉽게 파악할 수 있었습니다. 예를 들어, 맨해튼 중하부 지역에는 소음 관련 민원이 상당수 있었던 반면, 브루클린과 퀸즈 지역에서는 보도 상태가 주요 관심사였습니다. 이러한 신속한 데이터 기반 인사이트는 의사 결정권자들이 실행 가능한 조치를 취하는 데 도움이 될 수 있습니다.

벤치마크
성능은 고객이 분석 솔루션을 선택할 때 고려하는 중요한 요소입니다. Esri의 벤치마크 테스트에 따르면 GA Engine은 오픈 소스 패키지에 비해 빅데이터 공간 분석 실행 시 훨씬 뛰어난 성능을 제공합니다. 데이터 크기가 커질수록 성능 향상이 증가하므로, 사용자는 더 큰 데이터셋에서 더욱 향상된 성능을 경험할 수 있습니다. 예를 들어, 아래 표는 수백만 개의 데이터 레코드까지 다양한 크기의 두 입력 데이터셋(점과 폴리곤)을 조인하는 공간 교차 작업의 컴퓨팅 시간을 보여줍니다. 각 조인 시나리오는 단일 및 다중 머신 Databricks 클러스터에서 테스트되었습니다.

공간 교차 입력 컴퓨팅 시간 (초)
왼쪽 데이터셋 오른쪽 데이터셋 단일 머신 다중 머신
폴리곤 50개 점 6천 개 6 5
폴리곤 3천 개 점 6천 개 10 5
폴리곤 3천 개 점 2백만 개 19 9
폴리곤 3천 개 점 1,700만 개 46 16
폴리곤 22만 개 점 1,700만 개 80 29
폴리곤 1,100만 개 점 1,700만 개 515 (8.6분) 129 (2.1분)
폴리곤 1,100만 개 점 1,900만 개 1,373 (22분) 310 (5분)

아키텍처 및 설치
마무리하기 전에 GeoAnalytics Engine 아키텍처의 내부를 살펴보고 작동 방식을 알아보겠습니다. 클라우드 네이티브이며 Spark 네이티브이므로 클라우드 기반 Spark 환경에서 GeoAnalytics 라이브러리를 쉽게 사용할 수 있습니다. Databricks 환경에 GeoAnalytics Engine 배포를 설치하는 데는 최소한의 구성만 필요합니다. JAR 파일을 통해 모듈을 로드하면 클러스터에서 제공하는 리소스를 사용하여 실행됩니다.

설치는 AWS, Azure 및 GCP 전반에 적용되는 2가지 기본 단계로 구성됩니다.

  1. 작업 공간 준비
    • Databricks 작업 공간 생성 또는 시작
    • GeoAnalytics JAR 파일을 DBFS에 업로드
    • 초기화 스크립트 추가 및 활성화
  2. 클러스터 생성

Fig. 9 Azure Databricks 클러스터에 GA Engine 성공적으로 설치됨
Fig. 9 Azure Databricks 클러스터에 GA Engine 성공적으로 설치됨

설치 후 사용자는 Spark 환경에 연결된 Python 노트북을 사용하여 분석을 수행합니다. Databricks Lakehouse Platform 데이터에 즉시 액세스하여 분석을 수행할 수 있습니다. 분석 후에는 결과를 데이터 레이크, SQL Warehouse, BI(Business Intelligence) 서비스 또는 ArcGIS에 다시 기록하여 저장할 수 있습니다.

Figure 10. Databricks 환경을 위한 ArcGIS GeoAnalytics Engine 아키텍처
Figure 10. Databricks 환경을 위한 ArcGIS GeoAnalytics Engine 아키텍처

향후 계획

이 블로그에서는 Databricks에서 ArcGIS GeoAnalytics Engine의 강력한 기능을 소개하고, 가장 까다로운 지리 공간 사용 사례를 어떻게 함께 해결할 수 있는지 보여주었습니다. 위에서 보여준 예제에 대한 자세한 내용은 이 Databricks Notebook을 참조하세요. 앞으로 GeoAnalytics Engine은 GeoJSON 내보내기, H3 비닝 지원 및 K-최근접 이웃과 같은 클러스터링 알고리즘을 포함한 추가 기능으로 향상될 것입니다.

GeoAnalytics Engine은 Azure, AWS 및 GCP의 Databricks와 함께 작동합니다. 선호하는 Databricks 환경에 GeoAnalytics 라이브러리를 배포하는 방법에 대한 자세한 내용은 Databricks 및 Esri 계정 팀에 문의하십시오. GeoAnalytics Engine에 대해 자세히 알아보고 이 강력한 제품에 액세스하는 방법을 탐색하려면 Esri의 웹사이트를 방문하십시오.

(이 글은 AI의 도움을 받아 번역되었습니다. 원문이 궁금하시다면 여기를 클릭해 주세요)

게시물을 놓치지 마세요

관심 있는 카테고리를 구독하고 최신 게시물을 받은편지함으로 받아보세요