Azure Synapse Spark: Read Spatial file (shp) into Geopandas dataframe from ADLS Gen2

Jason Campbell 51 Reputation points
2022-11-09T02:03:54.34+00:00

Hi

How can I read a spatial file into a Geopandas dataframe from ADLS Gen2?

import geopandas as gpd  
  
df = gpd.read_file('abfss://sswksfs@i__a.dfs.core.windows.net/.../<file>')  

gave me a 'No such file or directory' error.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
5,378 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jason Campbell 6 Reputation points
    2022-12-08T22:05:36.493+00:00

    Hi @HimanshuSinha-msft

    I found a work-around.

    1. Mount the storage with mssparkutils.fs.mount()
    2. Copy the file to the storage: mssparkutils.fs.cp("synfs:…","file:…")
    3. The file can now be opened from GeoPandas.

    Cheers,
    Jason

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.