infrapy 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. infrapy-0.1.0/.env.example +29 -0
  2. infrapy-0.1.0/.gitignore +282 -0
  3. infrapy-0.1.0/Biblioteca/0_Rascunho/2_ExtPorMUN.ipynb +342 -0
  4. infrapy-0.1.0/Biblioteca/0_Rascunho/Capacidade.ipynb +0 -0
  5. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/Extracao_XML.ipynb +826 -0
  6. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/Extracao_XML_Backup.ipynb +79374 -0
  7. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/Extracao_XML_VerRenan.ipynb +1531 -0
  8. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/GerarAlnEixos.ipynb +126 -0
  9. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/LISP/XY.lsp +168 -0
  10. infrapy-0.1.0/Biblioteca/0_Rascunho/Civil3D/ranges_corridors.ipynb +1194 -0
  11. infrapy-0.1.0/Biblioteca/0_Rascunho/ConcatenacaoPlanilhasQuantitativos.ipynb +69 -0
  12. infrapy-0.1.0/Biblioteca/0_Rascunho/CriacaoRotasV2.ipynb +581 -0
  13. infrapy-0.1.0/Biblioteca/0_Rascunho/Cria/303/247/303/243oRotas.ipynb +126 -0
  14. infrapy-0.1.0/Biblioteca/0_Rascunho/Desapropria/303/247/303/243o.ipynb +782 -0
  15. infrapy-0.1.0/Biblioteca/0_Rascunho/Estudos.ipynb +447 -0
  16. infrapy-0.1.0/Biblioteca/0_Rascunho/Extra/303/247/303/243oEixos_InserirLatLong.ipynb +3326 -0
  17. infrapy-0.1.0/Biblioteca/0_Rascunho/GeradorKMZ.ipynb +702 -0
  18. infrapy-0.1.0/Biblioteca/0_Rascunho/GeradorKMZ_Geral.ipynb +1334 -0
  19. infrapy-0.1.0/Biblioteca/0_Rascunho/InterMun.ipynb +0 -0
  20. infrapy-0.1.0/Biblioteca/0_Rascunho/Km_Proj.ipynb +2069 -0
  21. infrapy-0.1.0/Biblioteca/0_Rascunho/Offset.ipynb +5453 -0
  22. infrapy-0.1.0/Biblioteca/0_Rascunho/SNVS.ipynb +395 -0
  23. infrapy-0.1.0/Biblioteca/0_Rascunho/SNVs/Conversor_SNVs.ipynb +678 -0
  24. infrapy-0.1.0/Biblioteca/0_Rascunho/SNVs/Corte_SNVs.ipynb +4179 -0
  25. infrapy-0.1.0/Biblioteca/0_Rascunho/TESTE.ipynb +1696 -0
  26. infrapy-0.1.0/Biblioteca/0_Rascunho/TH.ipynb +1450 -0
  27. infrapy-0.1.0/Biblioteca/0_Rascunho/TesteKMSNV.ipynb +650 -0
  28. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/00_LIXEIRA.ipynb +75 -0
  29. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/0_TESTES_GERAIS.ipynb +258 -0
  30. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/1_TESTES_GERAIS.ipynb +508 -0
  31. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/2_TESTE_Extra/303/247/303/243oRela/303/247/303/265esMEF.ipynb +136 -0
  32. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/ConcatenarPlanilhas.ipynb +84 -0
  33. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/DashBoard/DashBoard.ipynb +749 -0
  34. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/DashBoard/dashboard_interativo.html +279 -0
  35. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/DrenagemMEF/DrenagemMEF.ipynb +501 -0
  36. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/ExcelToDBS.ipynb +1211 -0
  37. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/MEF_GerarKMZ.ipynb +5475 -0
  38. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/MEF_LimparNomes.ipynb +327 -0
  39. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Ponto/config.json +4 -0
  40. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Ponto/iniciar_ponto.bat +8 -0
  41. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Ponto/ponto.db +0 -0
  42. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Ponto/ponto.py +963 -0
  43. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Rela/303/247/303/265es MEF/Exportar_Rela/303/247/303/265esMEF.ipynb" +449 -0
  44. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Rela/303/247/303/265es MEF/RelacoesMEF.ipynb" +274 -0
  45. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Rela/303/247/303/265es MEF/mef_network.html" +50 -0
  46. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Rela/303/247/303/265es MEF/mef_network_visjs.html" +90 -0
  47. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/UploadDBeaver/Downloads.ipynb +313 -0
  48. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/UploadDBeaver/Uploads.ipynb +853 -0
  49. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/VetorizarEdificacoes/VetorizarEdificacoes.ipynb +272 -0
  50. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Vetoriza/303/247/303/243oImagem/resultado_vetores.jpg +0 -0
  51. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Vetoriza/303/247/303/243oImagem/teste.ipynb +136 -0
  52. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/Vetoriza/303/247/303/243oImagem/vetores_rodovia.json +1 -0
  53. infrapy-0.1.0/Biblioteca/0_Rascunho/Testes/uninstallautodesk/AutoDeskUninstaller.ps1 +67 -0
  54. infrapy-0.1.0/Biblioteca/0_Rascunho/_Cadastro_Tratamento.ipynb +291 -0
  55. infrapy-0.1.0/Biblioteca/0_Rascunho/aln_gdf.ipynb +4117 -0
  56. infrapy-0.1.0/Biblioteca/0_Rascunho/pp.ipynb +57 -0
  57. infrapy-0.1.0/Biblioteca/2_Completos/AtualizarALN.ipynb +240 -0
  58. infrapy-0.1.0/Biblioteca/2_Completos/AtualizarALN.py +41 -0
  59. infrapy-0.1.0/Biblioteca/2_Completos/ConversorV2.ipynb +390 -0
  60. infrapy-0.1.0/Biblioteca/2_Completos/DivisorV2.ipynb +667 -0
  61. infrapy-0.1.0/Biblioteca/2_Completos/GeradorKMZ.py +268 -0
  62. infrapy-0.1.0/Biblioteca/2_Completos/LimpezaSharePoint/informacoes_vazio.py +38 -0
  63. infrapy-0.1.0/Biblioteca/2_Completos/LimpezaSharePoint/limparsharepoint.ipynb +255 -0
  64. infrapy-0.1.0/Biblioteca/2_Completos/LimpezaSharePoint/limparsharepoint.py +265 -0
  65. infrapy-0.1.0/Biblioteca/2_Completos/ListarArquivos/ListarItens.ipynb +302 -0
  66. infrapy-0.1.0/Biblioteca/2_Completos/Untitled5.ipynb +725 -0
  67. infrapy-0.1.0/Biblioteca/2_Completos/mapeador - Copia.py +424 -0
  68. infrapy-0.1.0/Biblioteca/2_Completos/mapeador.py +424 -0
  69. infrapy-0.1.0/Biblioteca/2_Completos/py_vgeo - Copia.py +267 -0
  70. infrapy-0.1.0/Biblioteca/2_Completos/py_vgeo.py +267 -0
  71. infrapy-0.1.0/Biblioteca/2_Completos/setup.py +42 -0
  72. infrapy-0.1.0/Old/AutoCAD_PlotarRetangulos.ipynb +661 -0
  73. infrapy-0.1.0/PKG-INFO +100 -0
  74. infrapy-0.1.0/README.md +70 -0
  75. infrapy-0.1.0/pyproject.toml +53 -0
  76. infrapy-0.1.0/src/infrapy/__init__.py +12 -0
  77. infrapy-0.1.0/src/infrapy/config.py +131 -0
  78. infrapy-0.1.0/src/infrapy/cores.py +120 -0
  79. infrapy-0.1.0/src/infrapy/excel.py +147 -0
  80. infrapy-0.1.0/src/infrapy/export.py +42 -0
  81. infrapy-0.1.0/src/infrapy/geo.py +569 -0
  82. infrapy-0.1.0/src/infrapy/interface.py +30 -0
  83. infrapy-0.1.0/src/infrapy/mapas.py +85 -0
  84. infrapy-0.1.0/src/infrapy/sharepoint.py +76 -0
@@ -0,0 +1,29 @@
1
+ # ===== Caminhos padrão =====
2
+ ACC_PATH=Caminho_Ate_o_Projeto\Infra S.A-
3
+ SHAREPOINT_PATH=Caminho_local_ate_o_Sharepoint\SUROD
4
+ REDE_PATH=\\svdf01002\unidade_1\GEINF\_Gestão_Rodovias\_Automação\Python # Caminho local até a pasta do projeto no servidor da rede da Infra S.A, contudo, esse caminho é padrão.
5
+
6
+ # ===== SharePoint =====
7
+ INFRA_USER=SeuEmailDaInfra@infrasa.gov.br
8
+ INFRA_SENHA=SuaSenhaDaInfra
9
+ INFRA_SITE=https://XXX.sharepoint.com/sites/XXX
10
+ INFRA_URL=/sites/XXX/Documentos Compartilhados/XXX
11
+
12
+ # ===== SharePoint - Azure (peça à TI) =====
13
+ INFRA_AZURE_CLIENT_ID=SeuClientID
14
+ INFRA_AZURE_CLIENT_SECRET=SuaClientSecret
15
+ INFRA_AZURE_TENANT_ID=SuaTenantID
16
+
17
+ INFRA_AZURE_AUTHORITY=https://login.microsoftonline.com/${INFRA_AZURE_TENANT_ID}
18
+
19
+ CERT_THUMBPRINT=SeuThumbprint
20
+ CERT_ID=SeuCertId
21
+ CERT_KEY=seu_caminho_para_o_certificado.pem
22
+
23
+ # ===== DBeaver / PostgreSQL =====
24
+ DBEAVER_USER=seu_usuario
25
+ DBEAVER_PASSWORD=sua_senha
26
+ DBEAVER_HOST=seu_host
27
+ DBEAVER_PORT=sua_porta # O padrão é: 5432
28
+ DBEAVER_DATABASE=seu_banco
29
+ DBEAVER_URL=jdbc:postgresql://${DBEAVER_HOST}:${DBEAVER_PORT}/${DBEAVER_DATABASE}
@@ -0,0 +1,282 @@
1
+ #################### VISUAL STUDIO CODE ####################
2
+ .vscode/*
3
+ !.vscode/settings.json
4
+ !.vscode/tasks.json
5
+ !.vscode/launch.json
6
+ !.vscode/extensions.json
7
+ !.vscode/*.code-snippets
8
+ !*.code-workspace
9
+
10
+ # Built Visual Studio Code Extensions
11
+ *.vsix
12
+
13
+ #############################################################
14
+
15
+ #################### JUPYTER NOTEBOOK ####################
16
+ .ipynb_checkpoints
17
+ */.ipynb_checkpoints/*
18
+
19
+ # IPython
20
+ profile_default/
21
+ ipython_config.py
22
+
23
+ # Jupyter lab virtual documents
24
+ # https://jupyterlab-lsp.readthedocs.io/en/2.x/Configuring.html#virtual_documents_dir
25
+ .virtual_documents/
26
+
27
+ # Remove previous ipynb_checkpoints
28
+ # git rm -r .ipynb_checkpoints/
29
+ ##########################################################
30
+
31
+ #################### PYTHON ####################
32
+
33
+ # Byte-compiled / optimized / DLL files
34
+ */__pycache__/
35
+ *__pycache__*
36
+ *.py[codz]
37
+ *$py.class
38
+
39
+ # C extensions
40
+ *.so
41
+
42
+ # Distribution / packaging
43
+ .Python
44
+ build/
45
+ develop-eggs/
46
+ dist/
47
+ downloads/
48
+ eggs/
49
+ .eggs/
50
+ lib/
51
+ lib64/
52
+ parts/
53
+ sdist/
54
+ var/
55
+ wheels/
56
+ share/python-wheels/
57
+ *.egg-info/
58
+ .installed.cfg
59
+ *.egg
60
+ MANIFEST
61
+
62
+ # PyInstaller
63
+ # Usually these files are written by a python script from a template
64
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
65
+ *.manifest
66
+ *.spec
67
+
68
+ # Installer logs
69
+ pip-log.txt
70
+ pip-delete-this-directory.txt
71
+
72
+ # Unit test / coverage reports
73
+ htmlcov/
74
+ .tox/
75
+ .nox/
76
+ .coverage
77
+ .coverage.*
78
+ .cache
79
+ nosetests.xml
80
+ coverage.xml
81
+ *.cover
82
+ *.py.cover
83
+ *.lcov
84
+ .hypothesis/
85
+ .pytest_cache/
86
+ cover/
87
+
88
+ # Translations
89
+ *.mo
90
+ *.pot
91
+
92
+ # Django stuff:
93
+ *.log
94
+ local_settings.py
95
+ db.sqlite3
96
+ db.sqlite3-journal
97
+
98
+ # Flask stuff:
99
+ instance/
100
+ .webassets-cache
101
+
102
+ # Scrapy stuff:
103
+ .scrapy
104
+
105
+ # Sphinx documentation
106
+ docs/_build/
107
+
108
+ # PyBuilder
109
+ .pybuilder/
110
+ target/
111
+
112
+ # Jupyter Notebook
113
+ .ipynb_checkpoints
114
+
115
+ # IPython
116
+ profile_default/
117
+ ipython_config.py
118
+
119
+ # pyenv
120
+ # For a library or package, you might want to ignore these files since the code is
121
+ # intended to run in multiple environments; otherwise, check them in:
122
+ # .python-version
123
+
124
+ # pipenv
125
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
126
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
127
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
128
+ # install all needed dependencies.
129
+ # Pipfile.lock
130
+
131
+ # UV
132
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
133
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
134
+ # commonly ignored for libraries.
135
+ # uv.lock
136
+
137
+ # poetry
138
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
139
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
140
+ # commonly ignored for libraries.
141
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
142
+ # poetry.lock
143
+ # poetry.toml
144
+
145
+ # pdm
146
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
147
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
148
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
149
+ # pdm.lock
150
+ # pdm.toml
151
+ .pdm-python
152
+ .pdm-build/
153
+
154
+ # pixi
155
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
156
+ # pixi.lock
157
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
158
+ # in the .venv directory. It is recommended not to include this directory in version control.
159
+ .pixi/*
160
+ !.pixi/config.toml
161
+
162
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
163
+ __pypackages__/
164
+
165
+ # Celery stuff
166
+ celerybeat-schedule*
167
+ celerybeat.pid
168
+
169
+ # Redis
170
+ *.rdb
171
+ *.aof
172
+ *.pid
173
+
174
+ # RabbitMQ
175
+ mnesia/
176
+ rabbitmq/
177
+ rabbitmq-data/
178
+
179
+ # ActiveMQ
180
+ activemq-data/
181
+
182
+ # SageMath parsed files
183
+ *.sage.py
184
+
185
+ # Environments
186
+ .env
187
+ .envrc
188
+ .venv
189
+ env/
190
+ venv/
191
+ ENV/
192
+ env.bak/
193
+ venv.bak/
194
+
195
+ # Spyder project settings
196
+ .spyderproject
197
+ .spyproject
198
+
199
+ # Rope project settings
200
+ .ropeproject
201
+
202
+ # mkdocs documentation
203
+ /site
204
+
205
+ # mypy
206
+ .mypy_cache/
207
+ .dmypy.json
208
+ dmypy.json
209
+
210
+ # Pyre type checker
211
+ .pyre/
212
+
213
+ # pytype static type analyzer
214
+ .pytype/
215
+
216
+ # Cython debug symbols
217
+ cython_debug/
218
+
219
+ # PyCharm
220
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
221
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
222
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
223
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
224
+ # .idea/
225
+
226
+ # Abstra
227
+ # Abstra is an AI-powered process automation framework.
228
+ # Ignore directories containing user credentials, local state, and settings.
229
+ # Learn more at https://abstra.io/docs
230
+ .abstra/
231
+
232
+ # Visual Studio Code
233
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
234
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
235
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
236
+ # you could uncomment the following to ignore the entire vscode folder
237
+ # .vscode/
238
+ # Temporary file for partial code execution
239
+ tempCodeRunnerFile.py
240
+
241
+ # Ruff stuff:
242
+ .ruff_cache/
243
+
244
+ # PyPI configuration file
245
+ .pypirc
246
+
247
+ # Marimo
248
+ marimo/_static/
249
+ marimo/_lsp/
250
+ __marimo__/
251
+
252
+ # Streamlit
253
+ .streamlit/secrets.toml
254
+
255
+ ################################################
256
+
257
+ #################### FOLDERS ####################
258
+ *.key
259
+ *.pem
260
+
261
+ Shapes
262
+ Utilitarios
263
+ Danillo
264
+ code_base
265
+ Biblioteca/0_Rascunho/1_Shapes
266
+ Biblioteca/0_Rascunho/Desapropriação
267
+ Biblioteca/2_Completos/ListarArquivos/Listas
268
+ *Lixeira*
269
+ Biblioteca/5_SIMEMP
270
+ *.csv
271
+ *.xls
272
+ *.xlsm
273
+ *.xlsb
274
+ *.xlsx
275
+ *.cpg
276
+ *.dbf
277
+ *.idx
278
+ *.prj
279
+ *.shp
280
+ *.xml
281
+ *.shx
282
+ ################################################
@@ -0,0 +1,342 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [
8
+ {
9
+ "data": {
10
+ "text/plain": [
11
+ "<module 'base' from 'C:\\\\Users\\\\egoncalves.upa\\\\Desktop\\\\Edu\\\\Trabalho\\\\Drive Local\\\\Biblioteca\\\\base.py'>"
12
+ ]
13
+ },
14
+ "execution_count": 1,
15
+ "metadata": {},
16
+ "output_type": "execute_result"
17
+ }
18
+ ],
19
+ "source": [
20
+ "import sys\n",
21
+ "import importlib\n",
22
+ "sys.path.append(r'C:\\Users\\egoncalves.upa\\Desktop\\Edu\\Trabalho\\Drive Local\\Biblioteca')\n",
23
+ "import base\n",
24
+ "importlib.reload(base)"
25
+ ]
26
+ },
27
+ {
28
+ "cell_type": "code",
29
+ "execution_count": 2,
30
+ "metadata": {},
31
+ "outputs": [],
32
+ "source": [
33
+ "aln_gdf = base.read_shape()"
34
+ ]
35
+ },
36
+ {
37
+ "cell_type": "code",
38
+ "execution_count": 3,
39
+ "metadata": {},
40
+ "outputs": [],
41
+ "source": [
42
+ "nome = 'AreaDesap - v00'\n",
43
+ "caminho = fr'C:\\Users\\egoncalves.upa\\Desktop\\Edu\\Trabalho\\Drive Local\\Planilhas\\{nome}.xlsx'"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": 22,
49
+ "metadata": {},
50
+ "outputs": [],
51
+ "source": [
52
+ "ws = base.ler_excel(caminho,\"MUN\",'sh_df','EPSG:4674')\n",
53
+ "\n",
54
+ "for index,row in ws.iterrows():\n",
55
+ " ROD = row['ROD']\n",
56
+ " \n",
57
+ " kmi = row['km i']\n",
58
+ " kmf = row['km f']\n",
59
+ " \n",
60
+ " geometry = base.cortar2(aln_gdf,ROD,kmi,kmf)\n",
61
+ " \n",
62
+ " ws.loc[index, 'geometry'] = geometry\n",
63
+ "\n",
64
+ "ufs_unicos = ws['UF'].unique()\n",
65
+ "ws.to_file(fr'C:\\Users\\egoncalves.upa\\Desktop\\Edu\\Trabalho\\Drive Local\\Shapes\\MUN.shp')"
66
+ ]
67
+ },
68
+ {
69
+ "cell_type": "code",
70
+ "execution_count": 52,
71
+ "metadata": {},
72
+ "outputs": [],
73
+ "source": [
74
+ "aln_mun = base.read_shape(fr'C:\\Users\\egoncalves.upa\\Desktop\\Edu\\Trabalho\\Drive Local\\Shapes\\MUN.shp')"
75
+ ]
76
+ },
77
+ {
78
+ "cell_type": "code",
79
+ "execution_count": 24,
80
+ "metadata": {},
81
+ "outputs": [],
82
+ "source": [
83
+ "mun_gdf = base.read_shape(r'Y:\\GEINF\\_Gestão_Rodovias\\_Automação\\Python\\_geodatabase\\BR_Municipios_2021\\BR_Municipios_2021.shp')"
84
+ ]
85
+ },
86
+ {
87
+ "cell_type": "code",
88
+ "execution_count": 25,
89
+ "metadata": {},
90
+ "outputs": [],
91
+ "source": [
92
+ "mun_uf_gdf = mun_gdf[mun_gdf['SIGLA'].isin(ufs_unicos)].reset_index(drop=True)"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "code",
97
+ "execution_count": 26,
98
+ "metadata": {},
99
+ "outputs": [
100
+ {
101
+ "data": {
102
+ "text/html": [
103
+ "<div>\n",
104
+ "<style scoped>\n",
105
+ " .dataframe tbody tr th:only-of-type {\n",
106
+ " vertical-align: middle;\n",
107
+ " }\n",
108
+ "\n",
109
+ " .dataframe tbody tr th {\n",
110
+ " vertical-align: top;\n",
111
+ " }\n",
112
+ "\n",
113
+ " .dataframe thead th {\n",
114
+ " text-align: right;\n",
115
+ " }\n",
116
+ "</style>\n",
117
+ "<table border=\"1\" class=\"dataframe\">\n",
118
+ " <thead>\n",
119
+ " <tr style=\"text-align: right;\">\n",
120
+ " <th></th>\n",
121
+ " <th>CD_MUN</th>\n",
122
+ " <th>NM_MUN</th>\n",
123
+ " <th>SIGLA</th>\n",
124
+ " <th>AREA_KM2</th>\n",
125
+ " <th>geometry</th>\n",
126
+ " </tr>\n",
127
+ " </thead>\n",
128
+ " <tbody>\n",
129
+ " <tr>\n",
130
+ " <th>0</th>\n",
131
+ " <td>3100104</td>\n",
132
+ " <td>Abadia dos Dourados</td>\n",
133
+ " <td>MG</td>\n",
134
+ " <td>880.461</td>\n",
135
+ " <td>POLYGON ((-47.43543 -18.16778, -47.43401 -18.1...</td>\n",
136
+ " </tr>\n",
137
+ " <tr>\n",
138
+ " <th>1</th>\n",
139
+ " <td>3100203</td>\n",
140
+ " <td>Abaeté</td>\n",
141
+ " <td>MG</td>\n",
142
+ " <td>1817.067</td>\n",
143
+ " <td>POLYGON ((-45.16777 -18.89073, -45.16719 -18.8...</td>\n",
144
+ " </tr>\n",
145
+ " <tr>\n",
146
+ " <th>2</th>\n",
147
+ " <td>3100302</td>\n",
148
+ " <td>Abre Campo</td>\n",
149
+ " <td>MG</td>\n",
150
+ " <td>470.551</td>\n",
151
+ " <td>POLYGON ((-42.38219 -20.12176, -42.38205 -20.1...</td>\n",
152
+ " </tr>\n",
153
+ " <tr>\n",
154
+ " <th>3</th>\n",
155
+ " <td>3100401</td>\n",
156
+ " <td>Acaiaca</td>\n",
157
+ " <td>MG</td>\n",
158
+ " <td>101.886</td>\n",
159
+ " <td>POLYGON ((-43.13156 -20.34249, -43.13143 -20.3...</td>\n",
160
+ " </tr>\n",
161
+ " <tr>\n",
162
+ " <th>4</th>\n",
163
+ " <td>3100500</td>\n",
164
+ " <td>Açucena</td>\n",
165
+ " <td>MG</td>\n",
166
+ " <td>815.422</td>\n",
167
+ " <td>POLYGON ((-42.37085 -18.92507, -42.37036 -18.9...</td>\n",
168
+ " </tr>\n",
169
+ " <tr>\n",
170
+ " <th>...</th>\n",
171
+ " <td>...</td>\n",
172
+ " <td>...</td>\n",
173
+ " <td>...</td>\n",
174
+ " <td>...</td>\n",
175
+ " <td>...</td>\n",
176
+ " </tr>\n",
177
+ " <tr>\n",
178
+ " <th>848</th>\n",
179
+ " <td>3171808</td>\n",
180
+ " <td>Virginópolis</td>\n",
181
+ " <td>MG</td>\n",
182
+ " <td>439.878</td>\n",
183
+ " <td>POLYGON ((-42.70275 -18.66162, -42.70220 -18.6...</td>\n",
184
+ " </tr>\n",
185
+ " <tr>\n",
186
+ " <th>849</th>\n",
187
+ " <td>3171907</td>\n",
188
+ " <td>Virgolândia</td>\n",
189
+ " <td>MG</td>\n",
190
+ " <td>281.022</td>\n",
191
+ " <td>POLYGON ((-42.32180 -18.35685, -42.32146 -18.3...</td>\n",
192
+ " </tr>\n",
193
+ " <tr>\n",
194
+ " <th>850</th>\n",
195
+ " <td>3172004</td>\n",
196
+ " <td>Visconde do Rio Branco</td>\n",
197
+ " <td>MG</td>\n",
198
+ " <td>243.351</td>\n",
199
+ " <td>POLYGON ((-42.90610 -20.93325, -42.90587 -20.9...</td>\n",
200
+ " </tr>\n",
201
+ " <tr>\n",
202
+ " <th>851</th>\n",
203
+ " <td>3172103</td>\n",
204
+ " <td>Volta Grande</td>\n",
205
+ " <td>MG</td>\n",
206
+ " <td>205.552</td>\n",
207
+ " <td>POLYGON ((-42.57184 -21.68033, -42.57160 -21.6...</td>\n",
208
+ " </tr>\n",
209
+ " <tr>\n",
210
+ " <th>852</th>\n",
211
+ " <td>3172202</td>\n",
212
+ " <td>Wenceslau Braz</td>\n",
213
+ " <td>MG</td>\n",
214
+ " <td>102.487</td>\n",
215
+ " <td>POLYGON ((-45.35885 -22.46754, -45.35864 -22.4...</td>\n",
216
+ " </tr>\n",
217
+ " </tbody>\n",
218
+ "</table>\n",
219
+ "<p>853 rows × 5 columns</p>\n",
220
+ "</div>"
221
+ ],
222
+ "text/plain": [
223
+ " CD_MUN NM_MUN SIGLA AREA_KM2 \n",
224
+ "0 3100104 Abadia dos Dourados MG 880.461 \\\n",
225
+ "1 3100203 Abaeté MG 1817.067 \n",
226
+ "2 3100302 Abre Campo MG 470.551 \n",
227
+ "3 3100401 Acaiaca MG 101.886 \n",
228
+ "4 3100500 Açucena MG 815.422 \n",
229
+ ".. ... ... ... ... \n",
230
+ "848 3171808 Virginópolis MG 439.878 \n",
231
+ "849 3171907 Virgolândia MG 281.022 \n",
232
+ "850 3172004 Visconde do Rio Branco MG 243.351 \n",
233
+ "851 3172103 Volta Grande MG 205.552 \n",
234
+ "852 3172202 Wenceslau Braz MG 102.487 \n",
235
+ "\n",
236
+ " geometry \n",
237
+ "0 POLYGON ((-47.43543 -18.16778, -47.43401 -18.1... \n",
238
+ "1 POLYGON ((-45.16777 -18.89073, -45.16719 -18.8... \n",
239
+ "2 POLYGON ((-42.38219 -20.12176, -42.38205 -20.1... \n",
240
+ "3 POLYGON ((-43.13156 -20.34249, -43.13143 -20.3... \n",
241
+ "4 POLYGON ((-42.37085 -18.92507, -42.37036 -18.9... \n",
242
+ ".. ... \n",
243
+ "848 POLYGON ((-42.70275 -18.66162, -42.70220 -18.6... \n",
244
+ "849 POLYGON ((-42.32180 -18.35685, -42.32146 -18.3... \n",
245
+ "850 POLYGON ((-42.90610 -20.93325, -42.90587 -20.9... \n",
246
+ "851 POLYGON ((-42.57184 -21.68033, -42.57160 -21.6... \n",
247
+ "852 POLYGON ((-45.35885 -22.46754, -45.35864 -22.4... \n",
248
+ "\n",
249
+ "[853 rows x 5 columns]"
250
+ ]
251
+ },
252
+ "execution_count": 26,
253
+ "metadata": {},
254
+ "output_type": "execute_result"
255
+ }
256
+ ],
257
+ "source": [
258
+ "mun_uf_gdf"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": 58,
264
+ "metadata": {},
265
+ "outputs": [],
266
+ "source": [
267
+ "for index, row in aln_mun.iterrows():\n",
268
+ " for index_poly, row_poly in mun_uf_gdf.iterrows():\n",
269
+ " if row['geometry'].intersects(row_poly['geometry']):\n",
270
+ " intersection = row['geometry'].intersection(row_poly['geometry'])\n",
271
+ " porcentagem_extensao = (intersection.length / row['geometry'].length)\n",
272
+ " col_name = row_poly['NM_MUN']\n",
273
+ " aln_mun.loc[index, col_name] = porcentagem_extensao\n",
274
+ "\n",
275
+ "aln_mun2 = aln_mun.copy()\n",
276
+ "aln_mun2 = aln_mun2.drop(\"geometry\", axis=1)\n",
277
+ "aln_mun2.to_excel(r'C:\\Users\\egoncalves.upa\\Desktop\\Edu\\Trabalho\\Drive Local\\Planilhas\\Teste.xlsx', index=False)\n"
278
+ ]
279
+ },
280
+ {
281
+ "cell_type": "code",
282
+ "execution_count": 51,
283
+ "metadata": {},
284
+ "outputs": [
285
+ {
286
+ "data": {
287
+ "text/plain": [
288
+ "17.033722951455488"
289
+ ]
290
+ },
291
+ "execution_count": 51,
292
+ "metadata": {},
293
+ "output_type": "execute_result"
294
+ }
295
+ ],
296
+ "source": [
297
+ "aln_mun['geometry'][7].length*100"
298
+ ]
299
+ },
300
+ {
301
+ "cell_type": "code",
302
+ "execution_count": 59,
303
+ "metadata": {},
304
+ "outputs": [],
305
+ "source": [
306
+ "wb = base.xw.Book(caminho)\n",
307
+ "sheet = wb.sheets['MUN']\n",
308
+ "df_aln_mun = base.pd.DataFrame(aln_mun2)\n",
309
+ "sheet.range('sh_df').value = df_aln_mun"
310
+ ]
311
+ },
312
+ {
313
+ "cell_type": "code",
314
+ "execution_count": null,
315
+ "metadata": {},
316
+ "outputs": [],
317
+ "source": []
318
+ }
319
+ ],
320
+ "metadata": {
321
+ "kernelspec": {
322
+ "display_name": "Python 3",
323
+ "language": "python",
324
+ "name": "python3"
325
+ },
326
+ "language_info": {
327
+ "codemirror_mode": {
328
+ "name": "ipython",
329
+ "version": 3
330
+ },
331
+ "file_extension": ".py",
332
+ "mimetype": "text/x-python",
333
+ "name": "python",
334
+ "nbconvert_exporter": "python",
335
+ "pygments_lexer": "ipython3",
336
+ "version": "3.11.2"
337
+ },
338
+ "orig_nbformat": 4
339
+ },
340
+ "nbformat": 4,
341
+ "nbformat_minor": 2
342
+ }
File without changes