Quickstart#
If you are ready to jump in, this page will get you started with the Geodesic python API. This is intended to get the API installed and authenticated quickly but we recommend that if this is your first time using Geodesic that you read the overview guides, or jump straight into the Geodesic Basics section.
Installation#
You will want to use some sort of virtual environment to manage your python libraries. This ensures that you do notvhave version conflicts with any other projects you might have that also use python. We recommend Conda as it has the easiest installation options for libraries that need binaries.
To install miniconda (the lightweight Conda package manager) follow instructions here.
Once conda is installed we can create a virtual environment:
conda create -n geodesic python=3.10
conda activate geodesic
Installing the Geodesic Python API is done uing pip
. For getting started we recommend installing all dependencies.
pip install geodesic-api[all]
Authenticate with the API#
This can be done either from python or from the command line. For more information on authentication see Account Management.
CLI Authentication#
$ geodesic authenticate
A browser window should open and you will see the following screen.
{
"api_key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Python Authentication#
Python authentication can be done either in the python interpreter or a Jupyter environment.
import geodesic
geodesic.authenticate()
Create a Project#
Create your own personal project in within the SeerAI Graph. For more information on projects see Geodesic Projects.
geodesic.create_project(name="cookbook-examples", alias="Cookbooks Example Project", description="Test project for illustration purposes")
geodesic.set_active_project("cookbook-examples")
Add a Dataset#
Add a dataset to your project. This is just one example of one method of adding a dataset. For more information on adding datasets see Adding Datasets.
ds = geodesic.Dataset.from_tabular_data(
name='uscb-pop-centers',
url='gs://geodesic-public-data/CenPop2020_Mean_CO.geojson',
index_data=True,
crs='EPSG:4326',
)
ds.save()