Skip to content

Nigeria Geodata

Temporary logo

A Python library for fast and efficient access to geospatial data for Nigeria.

PyPI open_in_colab python_versions


Documentation: https://jeafreezy.github.io/nigeria_geodata/

Source Code: https://github.com/jeafreezy/nigeria_geodata


Nigeria Geodata is a fast and efficient Python client for accessing geospatial data for Nigeria.

The key features are:

  • High Performance: Offers exceptional speed with both synchronous and asynchronous support to cater to different use cases and performance needs
  • Map Visualization: Provides smooth map visualization using the fast Lonboard library.
  • Lightweight: Minimal dependencies—just one required (httpx), with optional extras available for additional features.
  • User-Friendly: Easy to use and learn; set up quickly with just a few lines of code.
  • CLI Support: Intuitive command-line interface built with Typer.
  • Real-Time Data: Fetches up-to-date data directly from the GRID3 database (more to come!), ensuring you always work with the latest information.
  • Advanced Filtering: Allows for precise filtering based on state names (e.g FCT, Lagos), bounding boxes (bbox), and areas of interest (AOI).

Dependency

nigeria_geodata depends on only one core package:

  • Httpx - for the api requests.

Additional Optional Dependencies

There are some additional dependencies you might want to install.

  • Typer - for cli support.
  • Lonboard - for map visualization.
  • Geopandas - to return the data as a geodataframe.
  • Pandas - to return the data as a dataframe.

Installation

Create and activate a virtual environment and then install nigeria_geodata:

To install the lightweight version using pip:

pip install nigeria-geodata

This version will return all the data as Python objects, mostly as a list, and list of dicts.

To install it with typer, lonboard and geopandas:

pip install nigeria-geodata['standard']

This version will allow you to get the data as a dataframe, geodataframe, or an interactive map.

pip install nigeria-geodata['cli']

This version provides CLI support for the package. It is also lightweight -- It will return the data as pure Python objects.

Get Started

For the simplest usecase, search for all the available health care data in Nigeria.

from nigeria_geodata import Grid3, AsyncGrid3# Syncsearch_results = Grid3().search("health")
print(search_results)
# this will return a dataframe with all the available health care datasets.# Asyncsearch_results = await AsyncGrid3().search("health")
print(search_results)
# this will return a dataframe with all the available health care datasets.

Under the hood, this makes an api request to the GRID3 database to get the datasets. Refer to the documentation and examples for more use cases.

Acknowledgment

In addition to the great libraries we're resting upon, we would also like to thank GRID3 for providing real-time and comprehensive geospatial data that powers this library.

License

This project is licensed under the terms of the MIT license. See LICENSE.MD.