Skip to content

pycensus.census.countries.chile.ine.loader

Loader for INE Chile Censo 2017 (via the Esri Chile DPA FeatureServer), returning a common-schema GeoDataFrame.

Technical aspects

Mirrors :mod:pycensus.mexico.inegi.loader's shape: reads as much as possible from pyCensus' parquet cache (:mod:pycensus.cache), fetching only the logical columns actually missing, and merges the result back into the shared per-level/region cache file.

Unlike Mexico's INEGI (a plain CSV per state), Chile's real source (:mod:pycensus.chile.api) returns geometry and attributes together in one GeoJSON response per level/region, cached to disk. So _fetch_missing here re-reads the very same cached raw file that :mod:pycensus.chile.geography already fetched for the boundary -- no second network call for the same level/region.

Only region, provincia, comuna, distrito are implemented (see :mod:pycensus.chile.geography for why nation/ block aren't).

Source

https://services.arcgis.com/r7t1P5pnkoOLRdhr/arcgis/rest/services/ Divisi%C3%B3n_Pol%C3%ADtico_Administrativa_y_Censal/FeatureServer

load(aoi=None, regions=None, level='comuna', year='latest', cache_dir=None, cache=True, data_dir=None)

Load INE Chile Censo 2017 data as a common-schema GeoDataFrame.

Parameters:

Name Type Description Default
aoi Optional[GeoDataFrame]

Area of interest. Used to auto-detect regions if not given (via :func:pycensus.chile.geography.regions_in_aoi), and to clip the final result.

None
regions Optional[Union[str, List[str]]]

Region name(s)/code(s) to load. Derived from aoi if omitted (aoi is then required).

None
level str

Standard geometry level name, resolved through :data:pycensus.chile.constants.LEVEL_FALLBACK. Only "region", "provincia", "comuna", "distrito" are implemented.

'comuna'
year Union[int, str]

Vintage year, or "latest". Only 2017 (Censo 2017, the only vintage this DPA service publishes) is available.

'latest'
cache_dir Optional[str]

Root of pyCensus' parquet cache. Defaults to :func:pycensus.cache.default_cache_dir.

None
cache bool

If False, bypass the parquet cache entirely.

True
data_dir Optional[str]

Base directory for the raw GeoJSON cache. Defaults to :data:pycensus.chile.constants.DEFAULT_DATA_DIR.

None

Returns:

Type Description
GeoDataFrame

GeoDataFrame with GEOID, geometry, and one ine_-prefixed

GeoDataFrame

column per logical column in :data:pycensus.chile.ine.schema.SCHEMA.

Raises:

Type Description
ValueError

If neither regions nor aoi is given.