Skip to content

Commit

Permalink
areas ponderacao por ufs
Browse files Browse the repository at this point in the history
  • Loading branch information
BAFurtado committed Jun 14, 2020
1 parent c5fffc4 commit 1066848
Show file tree
Hide file tree
Showing 117 changed files with 67 additions and 14 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
## Dados para Geração População Artificial por Áreas de Ponderação Censo 2010 IBGE

## Also. Weighted Areas (areas de ponderação) do IBGE.
##### Dissolved from original census tract. Official are missing some (no idea why)
## Áreas de ponderação do IBGE, dissolvidos dos setores censitários originais. Completa

## Also. Weighted Areas (areas de ponderação) do IBGE. Find them by UF (state)
### Dissolved from original census tract. Official are missing some (no idea why)

Os dados estão separados por código de uf. O código porém também gera o Brasil completo 72 MB.
Se quiser TODAS as áreas de ponderação do país (não disponíveis no IBGE) e não filtradas pelas Áreas
de Concentração da População (como utilizadas nesse trabalho), comente a linha #53 do arquivo `read_shapes2.py`

This is just a documented script. We gather official data and use **generator.py** at
https://github.com/BAFurtado/home_violence to come up with a random artificial population with gender, age and years
of study and color at the level of census tracts.
Expand Down
1 change: 1 addition & 0 deletions data/areas/13.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/13.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/13.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/13.shp
Binary file not shown.
Binary file added data/areas/13.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/15.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/15.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/15.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/15.shp
Binary file not shown.
Binary file added data/areas/15.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/16.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/16.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/16.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/16.shp
Binary file not shown.
Binary file added data/areas/16.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/21.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/21.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/21.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/21.shp
Binary file not shown.
Binary file added data/areas/21.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/22.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/22.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/22.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/22.shp
Binary file not shown.
Binary file added data/areas/22.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/23.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/23.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/23.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/23.shp
Binary file not shown.
Binary file added data/areas/23.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/24.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/24.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/24.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/24.shp
Binary file not shown.
Binary file added data/areas/24.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/25.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/25.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/25.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/25.shp
Binary file not shown.
Binary file added data/areas/25.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/26.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/26.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/26.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/26.shp
Binary file not shown.
Binary file added data/areas/26.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/27.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/27.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/27.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/27.shp
Binary file not shown.
Binary file added data/areas/27.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/28.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/28.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/28.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/28.shp
Binary file not shown.
Binary file added data/areas/28.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/29.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/29.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/29.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/29.shp
Binary file not shown.
Binary file added data/areas/29.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/31.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/31.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/31.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/31.shp
Binary file not shown.
Binary file added data/areas/31.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/32.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/32.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/32.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/32.shp
Binary file not shown.
Binary file added data/areas/32.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/33.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/33.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/33.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/33.shp
Binary file not shown.
Binary file added data/areas/33.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/35.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/35.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/35.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/35.shp
Binary file not shown.
Binary file added data/areas/35.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/41.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/41.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/41.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/41.shp
Binary file not shown.
Binary file added data/areas/41.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/42.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/42.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/42.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/42.shp
Binary file not shown.
Binary file added data/areas/42.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/43.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/43.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/43.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/43.shp
Binary file not shown.
Binary file added data/areas/43.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/50.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/50.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/50.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/50.shp
Binary file not shown.
Binary file added data/areas/50.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/51.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/51.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/51.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/51.shp
Binary file not shown.
Binary file added data/areas/51.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/52.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/52.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/52.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/52.shp
Binary file not shown.
Binary file added data/areas/52.shx
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/53.cpg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ISO-8859-1
Binary file added data/areas/53.dbf
Binary file not shown.
1 change: 1 addition & 0 deletions data/areas/53.prj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GEOGCS["GCS_SIRGAS_2000",DATUM["D_SIRGAS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file added data/areas/53.shp
Binary file not shown.
Binary file added data/areas/53.shx
Binary file not shown.
24 changes: 12 additions & 12 deletions read_shapes2.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,32 @@ def unzipping_census_tract(file, flag):
return path


def read_census_tracts_by_uf():
pass


def add_shapes(flag, aps_setores):
def census_into_weighted_areas(flag, aps_setores):
brasil = gpd.GeoDataFrame()
files = os.listdir(flag)
shps = [x for x in files if x.endswith('.shp')]
for file in shps:
print(f'processing {file}')
temp = gpd.read_file(os.path.join(flag, file))
temp = temp.merge(aps_setores, on='CD_GEOCODI')
if len(temp) == 0:
continue
temp = temp[['AREAP', 'geometry']]
temp['geometry'] = temp['geometry'].buffer(0.000001)
temp = temp.dissolve(by='AREAP')

return
name = file[:2]
temp.to_file(f'data/areas/{name}.shp')
brasil = pd.concat([temp, brasil])
brasil.to_file('data/areas/brasil.shp')


def main(path, directory, flag, data_flag):
def main(path, directory, flag, data_flag, aps_setores):
download_from_ibge(path, directory, flag)
files = os.listdir(data_fl)
paths = list()
for file in files:
paths.append(unzipping_census_tract(os.path.join(data_flag, file), data_flag))
census_into_weighted_areas(data_flag, aps_setores)


if __name__ == '__main__':
Expand All @@ -76,7 +78,5 @@ def main(path, directory, flag, data_flag):
data_fl = 'data/shapes_setores'
aps = aps.rename(columns={'Cod_setor': 'CD_GEOCODI'})
aps.CD_GEOCODI = aps.CD_GEOCODI.astype(str)
# main(site, folder, fl, data_fl)
add_shapes(data_fl, aps)


# main(site, folder, fl, data_fl, aps)
census_into_weighted_areas(data_fl, aps)

0 comments on commit 1066848

Please sign in to comment.