Visualizing and mapping your spatial data is a powerful step to provide context and help uncover patterns, trends, and relationships. Visualizing and mapping is analogous to charting and plotting with non-spatial data. It's a way to verify your analysis, iterate, and create shareable and engaging results.
In GeoAnalytics for Microsoft Fabric you can visualize your data in two ways:
- You can visualize datasets in your notebook. This allows you to view results as you analyze them.
- You can write out your data to visualize your datasets in other applications. This allows you to complete further analysis, share your results with your organization, or create other data products.
Visualization in a notebook
The st.plot
method in GeoAnalytics for Microsoft Fabric can be used for visualizing spatial results in your notebook.
GeoAnalytics for Microsoft Fabric | |
---|---|
Basemaps | |
Draw multiple layers | |
Zooming | |
Identify records | |
Modify colors and symbols | |
Record limit |
The st.plot method in GeoAnalytics for Microsoft Fabric extends
matplotlib
to enable simple visualization of geometries from one or more DataFrames in a PySpark notebook.
By calling st.plot()
on a DataFrame with a geometry column you can plot each geometry record in the column
and configure the plot's coloring, extent, axes, legend and more. For example, the snippet below shows
how you can plot a dataset, symbolize on a column, and generate a legend with just one line of code.
import geoanalytics_fabric
# Get states polygons
url = "https://services.arcgis.com/P3ePLMYs2RVChkJx/ArcGIS/rest/services/USA_States_Generalized/FeatureServer/0"
states = spark.read.format("feature-service").load(url).where("STATE_ABBR NOT IN ('AK','HI')")
# Plot states
states.st.plot(cmap_values="POPULATION", figsize=(15, 8), legend=True, legend_kwds={"label": "Population"})
To learn more about using st.plot
, see the API reference and the tutorial on plotting in GeoAnalytics for Microsoft Fabric.
Other visualization options
GeoAnalytics for Microsoft Fabric supports writing Spark DataFrames to multiple formats that can be visualized in common mapping and GIS applications:
-
Vector tile layers—For fast drawing of point data at multiple scales in desktop and web applications. To learn more see Vector tiles.
-
Shapefiles—Supports points, lines, and polygons. Can be used in most GIS applications. Learn more about using shapefiles in this tutorial.
In addition, you can convert a PySpark DataFrame to a Spatially Enabled DataFrame using the to
method
and write the Spatially Enabled DataFrame to a feature service
for visualization in ArcGIS.
ArcGIS Online, ArcGIS Enterprise,
and ArcGIS Pro are Esri products for
mapping, visualization, and analysis of spatial data that support feature services, shapefiles, and vector tile layers.