Semantic Link Functions for Geopandas
Semantic link functions for Geopandas enables conversion of a FabricDataFrame to a GeoDataFrame. This package is part of the broader Microsoft Fabric Semantic Link ecosystem, which facilitates connecting Power BI datasets with Synapse Data Science. It is actively maintained, with new versions often released in conjunction with other `semantic-link` packages.
Warnings
- breaking Installing `semantic-link` (and thus implicitly `semantic-link-functions-geopandas`) with `pandas >= 3.0` can cause runtime errors due to breaking changes in Pandas' internal API. Microsoft is actively working on a fix.
- gotcha The full Semantic Link feature set, including the semantic functions and `FabricDataFrame`'s capabilities, is primarily designed and supported for use within Microsoft Fabric notebooks and environments. While the Python packages can be installed locally, their full integration with Power BI semantic models is specific to the Fabric platform.
- deprecated The underlying `geopandas` library has enforced several deprecations in recent major versions (e.g., `geopandas.datasets` module removed, `geopandas.io.read_file` deprecated in favor of `geopandas.read_file`). Users migrating or updating `geopandas` versions independently of `semantic-link-functions-geopandas` should be aware of these changes.
Install
-
pip install semantic-link-functions-geopandas -
pip install semantic-link
Imports
- FabricDataFrame
from sempy.fabric import FabricDataFrame
Quickstart
import pandas as pd
from sempy.fabric import FabricDataFrame
# Example FabricDataFrame (usually obtained from a Power BI dataset in Fabric)
df = FabricDataFrame(
{
"country": ["US", "AT"],
"lat": [40.7128, 47.8095],
"long": [-74.0060, 13.0550]
},
column_metadata={
"lat": {"data_category": "Latitude"},
"long": {"data_category": "Longitude"}
},
pd_dataframe=pd.DataFrame()
)
# Convert to GeoDataFrame
df_geo = df.to_geopandas(lat_col="lat", long_col="long")
print(df_geo.head())
print(df_geo.geometry.name)