~tfardet/gistools

Various tools to simplify some basic GIS queries in Python
Fix EPCI insee_com entries
Use `name` for EPCI, minor cleanups, update for French parcels
Update level4 for France and add `get_epci`

clone

read-only
https://git.sr.ht/~tfardet/gistools
read/write
git@git.sr.ht:~tfardet/gistools

You can also use your local clone with git send-email.

#GIStools: demographics, agriculture and OSM helper functions

WARNING: this library is in early alpha and code (including user API) may break or change without notice, do not use in production!

This library provides various tools to fetch geospatial data regarding:

  • administrative boundaries
  • demographics
  • agricultural parcels
  • various elements and buildings from OpenStreetMap

#Requirements

The library is built upon various other tools like geopandas and osmnx. All dependencies are listed in requirements.txt.

#Installation

Download this package, enter the folder and type pip install .

#Organization and functions

The library is organized into the following modules:

  • admin function relative to administrative areas and boundaries (countries, regions, cities...)
  • countries, country-specific implementations used internally, do not use directly
  • demographics, functions giving detailed population data
  • osm, OpenStreetMap query module
  • parcels, get agricultural data
  • utils, various helper tools (for internal use)

Import the library via

import gistools as gt

To check/set the configuration, use gt.get_config and gt.set_config.

To get any administrative boundary, just enter the country name or ISO code and the area name or local code:

boundary = gt.admin.get_admin_boundaries("France", "Rennes")

To get local populations use:

# Local population (detailed results by age/sex for France only at the moment)
gt.demographics.get_local_population("France", "Ivry-sur-Seine")

# schools and high-ed students for France only
gt.demographics.get_local_schools("France", "Toulouse")
gt.demographics.get_local_higher_education("France", "Toulouse")

To get OSM data:

gt.osm.get_all_local_features("France", "Quincieux")

# or more limited, e.g.
gt.osm.get_green_areas("France", "Quincieux")

#Known issues

  • the GADM database used to get administrative boundaries is outdated, I am looking for alternatives (notably https://www.geoboundaries.org)
  • no CI (will be implemented soon)