Getting Started#

This guide will help you install SpaceNet and run a minimal example.

Installation#

SpaceNet is available on PyPI and can be installed using pip or with modern Python package managers such as uv and pixi. Choose the method that best suits your environment:

pip install spacenet
uv add spacenet
pixi add spacenet

Minimal example#

Below is a minimal example demonstrating how to import SpaceNet and begin working with spatial networks.

import spacenet as sn

# Load the spiral dataset and extract the 'x' and 'y' columns as points
spiral_data = sn.datasets.load_dataset('spiral')
points = spiral_data[['x', 'y']].to_numpy()

# generate a spatial network
G = sn.utils.spatial_network_from_points(points,max_edge_distance=50)

# plot the spatial network
sn.utils.plot_spatial_network(G)

The output of this snippet will be a plot of the spatial network generated from the spiral dataset. The nodes of the network correspond to the points in the dataset, and edges are drawn between nodes that are within a specified distance of each other.

Next steps#

Using SpaceNet

Examples of how to use SpaceNet for different applications can be found in the examples section. The examples are a great way to get started with SpaceNet and to learn how to use it for your own projects.

API reference

Explore the full API reference for SpaceNet, including detailed documentation for all functions, classes, and modules. This is the go-to resource for understanding the capabilities of SpaceNet and how to use them effectively.