ESCatastroLib 0.0.1rc2__py2.py3-none-any.whl
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.
- ESCatastroLib/__about__.py +4 -0
- ESCatastroLib/__init__.py +6 -0
- ESCatastroLib/models/Calle.py +51 -0
- ESCatastroLib/models/InfoCatastral.py +427 -0
- ESCatastroLib/models/Municipio.py +30 -0
- ESCatastroLib/models/__init__.py +4 -0
- ESCatastroLib/utils/__init__.py +4 -0
- ESCatastroLib/utils/converters.py +65 -0
- ESCatastroLib/utils/exceptions.py +21 -0
- ESCatastroLib/utils/statics.py +141 -0
- ESCatastroLib/utils/utils.py +213 -0
- escatastrolib-0.0.1rc2.dist-info/METADATA +367 -0
- escatastrolib-0.0.1rc2.dist-info/RECORD +15 -0
- escatastrolib-0.0.1rc2.dist-info/WHEEL +5 -0
- escatastrolib-0.0.1rc2.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ESCatastroLib
|
|
3
|
+
Version: 0.0.1rc2
|
|
4
|
+
Summary: Una librería de Python para consultar los datos del Catastro COMO OBJETOS. Incluye información geográfica.
|
|
5
|
+
Project-URL: Documentation, https://github.com/IvanitiX/ESCatastroLib#readme
|
|
6
|
+
Project-URL: Issues, https://github.com/IvanitiX/ESCatastroLib/issues
|
|
7
|
+
Project-URL: Source, https://github.com/IvanitiX/ESCatastroLib
|
|
8
|
+
Author-email: "Iván V.R" <IvanVR@protonmail.com>
|
|
9
|
+
License: Apache License (2.0)
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: catastro,espana,gis,spain
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Framework :: Pytest
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Natural Language :: Spanish
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
20
|
+
Requires-Dist: folium
|
|
21
|
+
Requires-Dist: geopandas
|
|
22
|
+
Requires-Dist: pyarrow
|
|
23
|
+
Requires-Dist: pytest
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: shapely
|
|
26
|
+
Requires-Dist: xmltodict
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# ESCatastroLib
|
|
30
|
+
|
|
31
|
+
La librería ESCatastroLib proporciona una interfaz sencilla para consultar el Catastro de España y obtener información geográfica precisa. Con esta librería, puedes acceder a datos como la ubicación de parcelas, características de construcción y valores geográficos.
|
|
32
|
+
|
|
33
|
+
# Clases
|
|
34
|
+
|
|
35
|
+
## Clase Municipio
|
|
36
|
+
|
|
37
|
+
Representa un municipio (ciudad o pueblo).
|
|
38
|
+
|
|
39
|
+
**Atributos/Inputs del constructor**
|
|
40
|
+
|
|
41
|
+
`provincia (str)`: El nombre de la provincia donde se encuentra el municipio. Un valor por
|
|
42
|
+
defecto se establece y se puede proporcionar un valor diferente si es necesario.
|
|
43
|
+
|
|
44
|
+
`municipio (str, opcional)`: El nombre del municipio. Si no se proporciona al crear una instancia, se
|
|
45
|
+
lanzará una excepción. Si se especifica, debe coincidir al menos parcialmente con el nombre de un municipio válido encontrado en la base de datos o fuente de datos del sistema.
|
|
46
|
+
|
|
47
|
+
**Excepciones**
|
|
48
|
+
|
|
49
|
+
`Exception`: Si no se especifica el `municipio` o si es inválido, o si no corresponde a un municipio válido
|
|
50
|
+
en la base de datos del sistema. Se lanzará una excepción con la lista de municipios en ese caso.
|
|
51
|
+
|
|
52
|
+
## Clase Calle
|
|
53
|
+
|
|
54
|
+
La clase `Calle` es una entidad que representa una calle.
|
|
55
|
+
|
|
56
|
+
**Atributos/Inputs del constructor:**
|
|
57
|
+
|
|
58
|
+
`municipio (Municipio)` : Objeto que representa el Municipio al que pertenece la calle.
|
|
59
|
+
|
|
60
|
+
`nombre_calle (str, opcional)` : El nombre de la calle asignada.
|
|
61
|
+
|
|
62
|
+
`tipo_via (str, opcional)` : El tipo de vía de la calle asignada. Se trata de una serie de siglas que puedes consultar en `utils.listar_tipos_via()`
|
|
63
|
+
|
|
64
|
+
**Excepciones**
|
|
65
|
+
|
|
66
|
+
`Exception`: Si no existe la calle, o la calle tiene más de un tipo de vía. Devuelve una lista de calles en formato `TipoVia NombreCalle`
|
|
67
|
+
|
|
68
|
+
## Clase ParcelaCatastral
|
|
69
|
+
|
|
70
|
+
Representa una parcela catastral.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
**Inputs del constructor:**
|
|
74
|
+
|
|
75
|
+
* `rc (str, opcional)`: La referencia catastral de la parcela. Por defecto es `None`. Puede ser proporcionada
|
|
76
|
+
sola; también puede haber otros parámetros para buscar una parcela específica en el sistema.
|
|
77
|
+
* `provincia (str, opcional)`: El nombre de la provincia. Por defecto es `None`. Se usa para
|
|
78
|
+
buscar por dirección o parcela.
|
|
79
|
+
* `municipio (str, opcional)`: El nombre del municipio. Por defecto es `None`. Se usa para buscar
|
|
80
|
+
por dirección o parcela.
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
* `poligono (int, opcional)`: El número del polígono. Por defecto es `None` y puede ser específico para zonas rurales.
|
|
84
|
+
* `parcela (int, opcional)`: El número de la parcela. Por defecto es `None` y se usa para buscar zonas rurales.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
* `tipo_via (str, opcional)`: El tipo de carretera en la dirección. Por defecto es `None` y es útil al buscar
|
|
89
|
+
direcciones urbanas.
|
|
90
|
+
* `calle (str, opcional)`: El nombre de la calle en la dirección. Por defecto es `None` y es útil para
|
|
91
|
+
encontrar ubicaciones urbanas
|
|
92
|
+
* `numero (str, opcional)`: El número de la calle en la dirección. Por defecto es `None` y se usa para encontrar
|
|
93
|
+
ubicaciones urbanas por número.
|
|
94
|
+
|
|
95
|
+
**Excepciones:**
|
|
96
|
+
* `ValueError`: Si no has proporcionado suficiente información para realizar la búsqueda, o si el RC hace
|
|
97
|
+
referencia a una MetaParcela.
|
|
98
|
+
* `ErrorServidorCatastro`: Si hay un error con la base de datos del Catastral Server.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
**Atributos:**
|
|
102
|
+
|
|
103
|
+
* `rc (str)`: La referencia catastral de la parcela.
|
|
104
|
+
* `provincia (str)`: El nombre de la provincia.
|
|
105
|
+
* `municipio (str)`: El nombre del municipio.
|
|
106
|
+
* `poligono (int)`: El número del polígono. Solo se usa para terrenos rurales.
|
|
107
|
+
* `parcela (int)`: El número de la parcela. Solo se usa para terrenos rurales.
|
|
108
|
+
* `tipo_via (str)`: El tipo de carretera en la dirección.
|
|
109
|
+
* `calle (str)`: El nombre de la calle en la dirección.
|
|
110
|
+
* `numero (str)`: El número de la calle en la dirección.
|
|
111
|
+
* `url_croquis (str)`: La URL del croquis de la parcela.
|
|
112
|
+
* `tipo (str)`: El tipo de terreno (urbano o rural).
|
|
113
|
+
* `antiguedad (str)`: La edad de la parcela (solo en lotes urbanos)
|
|
114
|
+
* `uso (str)`: El uso de la parcela (solo en lotes urbanos)
|
|
115
|
+
* `nombre_paraje (str)`: El nombre del área, solo se usa para terrenos rurales.
|
|
116
|
+
* `regiones (list)`: Una lista de regiones en la parcela con una descripción y superficie.
|
|
117
|
+
* `centroide (dict)`: Las coordenadas del centroide de la parcela. (Latitud y longitud)
|
|
118
|
+
* `geometria (list)`: Una lista de puntos que representan la geometría de la parcela. (Latitud y longitud)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
## Clase MetaParcela
|
|
122
|
+
|
|
123
|
+
Representa una MetaParcela, es decir, una gran parcela catastral con varias referencias catastrales (Parcels
|
|
124
|
+
Catastrales más pequeñas).
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
**Atributos/Inputs del constructor:**
|
|
128
|
+
|
|
129
|
+
* `rc (Union[str,None])`: La referencia catastral de la MetaParcela. Puede ser proporcionada como `None`.
|
|
130
|
+
* `provincia (Union[str,None])`: El nombre de la provincia donde se encuentra la MetaParcela. Por
|
|
131
|
+
defecto, es `None`, lo que permite usar nombres generales.
|
|
132
|
+
* `municipio (Union[str,None])`: El nombre del municipio donde se encuentra la MetaParcela. Por
|
|
133
|
+
defecto, es `None`, lo que permite usar nombres generales.
|
|
134
|
+
* `poligono (Union[int,None])`: El número del polígono en el que se encuentra la MetaParcela. Se utiliza para encontrar
|
|
135
|
+
una parcela específica.
|
|
136
|
+
* `parcela (Union[int,None])`: El número de parcelas dentro de la MetaParcela. Se utiliza para encontrar una parcela
|
|
137
|
+
específica.
|
|
138
|
+
* `tipo_via (Union[str,None])`: Tipo de camino en la dirección de la MetaParcela. Se usa para encontrar una parcela
|
|
139
|
+
específica.
|
|
140
|
+
* `calle (Union[str,None])`: Nombre de la calle de la MetaParcela. Se usa para encontrar una parcela específica.
|
|
141
|
+
* `numero (Union[str,None])`: Número de casa de la MetaParcela.
|
|
142
|
+
|
|
143
|
+
**Atributos:**
|
|
144
|
+
|
|
145
|
+
* `rc (str)`: La referencia catastral de la MetaParcela.
|
|
146
|
+
* `parcelas (list)`: Una lista de ParcelaCatastral que representan las parcelas que componen la MetaParcela.
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
# Funciones útiles
|
|
151
|
+
|
|
152
|
+
## `comprobar_errores()`
|
|
153
|
+
|
|
154
|
+
Comprueba si la respuesta contiene errores.
|
|
155
|
+
|
|
156
|
+
**Argumentos**:
|
|
157
|
+
* `respuesta (dict)`: El diccionario de respuesta.
|
|
158
|
+
|
|
159
|
+
**Excepciones**:
|
|
160
|
+
* El que venga de `lanzar_excepcion` (`ErrorServidorCatastro`): Si se encuentra un error en la respuesta.
|
|
161
|
+
|
|
162
|
+
**Devuelve**:
|
|
163
|
+
* `True` si no se encuentran errores
|
|
164
|
+
|
|
165
|
+
## `listar_provincias()`
|
|
166
|
+
|
|
167
|
+
Obtiene una lista de provincias.
|
|
168
|
+
|
|
169
|
+
**Devuelve**:
|
|
170
|
+
* `list`: Una lista de nombres de provincias.
|
|
171
|
+
|
|
172
|
+
## `listar_municipios()`
|
|
173
|
+
|
|
174
|
+
Obtiene una lista de municipios de España.
|
|
175
|
+
|
|
176
|
+
**Argumentos**:
|
|
177
|
+
* `provincia (str)`: El nombre de la provincia. Preferentemente en mayúsculas o capitalizado.
|
|
178
|
+
* `municipio (str, optional)`: El nombre del municipio. Por defecto es None.
|
|
179
|
+
|
|
180
|
+
**Devuelve**:
|
|
181
|
+
* `List[str]`: Una lista de nombres de municipios.
|
|
182
|
+
|
|
183
|
+
**Excepciones**:
|
|
184
|
+
* `Exception`: Si la provincia no existe. Muestra un mensaje con las provincias disponibles.
|
|
185
|
+
|
|
186
|
+
## `listar_tipos_via()`
|
|
187
|
+
|
|
188
|
+
Retorna una lista de los tipos de vía disponibles.
|
|
189
|
+
|
|
190
|
+
**Devuelve**:
|
|
191
|
+
* `list`: Una lista de los tipos de vía disponibles.
|
|
192
|
+
|
|
193
|
+
## `listar_calles()`
|
|
194
|
+
|
|
195
|
+
Devuelve una lista de calles para una provincia y municipio dados.
|
|
196
|
+
|
|
197
|
+
**Argumentos**:
|
|
198
|
+
* `provincia (str)`: El nombre de la provincia.
|
|
199
|
+
* `municipio (str)`: El nombre del municipio.
|
|
200
|
+
|
|
201
|
+
**Devuelve**:
|
|
202
|
+
* `list`: Una lista de calles en formato "tipo de vía nombre de vía".
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
# Conversores
|
|
206
|
+
|
|
207
|
+
Las clases `ParcelaCatastral` y `MetaParcela` incluyen métodos para exportar los datos en diferentes formatos. Estos métodos permiten convertir los datos de las parcelas en formatos útiles para análisis y almacenamiento.
|
|
208
|
+
|
|
209
|
+
## Métodos disponibles
|
|
210
|
+
|
|
211
|
+
### `to_dataframe()`
|
|
212
|
+
|
|
213
|
+
Convierte la parcela o metaparcela en un DataFrame de GeoPandas, el cual incluye información geográfica.
|
|
214
|
+
|
|
215
|
+
**Devuelve**:
|
|
216
|
+
* `gpd.GeoDataFrame`: Un DataFrame que contiene los datos de la parcela o metaparcela.
|
|
217
|
+
|
|
218
|
+
### `to_json()`
|
|
219
|
+
Convierte la parcela o metaparcela en un archivo JSON.
|
|
220
|
+
|
|
221
|
+
**Argumentos**:
|
|
222
|
+
|
|
223
|
+
`filename (str, opcional)`: Nombre del archivo donde guardar el JSON. Si no se proporciona, devuelve el JSON como cadena.
|
|
224
|
+
|
|
225
|
+
**Devuelve**:
|
|
226
|
+
|
|
227
|
+
`str`: Una cadena JSON que contiene los datos de la parcela o metaparcela, en caso de no añadir `filename`.
|
|
228
|
+
|
|
229
|
+
Un archivo con el `filename` en caso de añadirlo.
|
|
230
|
+
|
|
231
|
+
### `to_csv()`
|
|
232
|
+
Convierte la parcela o metaparcela en un archivo CSV.
|
|
233
|
+
|
|
234
|
+
**Argumentos**:
|
|
235
|
+
|
|
236
|
+
`filename (str, opcional)`: Nombre del archivo donde guardar el JSON. Si no se proporciona, devuelve el CSV como cadena.
|
|
237
|
+
|
|
238
|
+
**Devuelve**:
|
|
239
|
+
|
|
240
|
+
`str`: Una cadena CSV que contiene los datos de la parcela o metaparcela, en caso de no añadir `filename`.
|
|
241
|
+
|
|
242
|
+
Un archivo con el `filename` en caso de añadirlo.
|
|
243
|
+
|
|
244
|
+
# `to_shapefile()`
|
|
245
|
+
Guarda la parcela o metaparcela como un archivo Shapefile.
|
|
246
|
+
|
|
247
|
+
**Argumentos**:
|
|
248
|
+
|
|
249
|
+
`filename (str)`: El nombre del archivo Shapefile a guardar.
|
|
250
|
+
|
|
251
|
+
**Devuelve**:
|
|
252
|
+
|
|
253
|
+
Un archivo con el `filename`.
|
|
254
|
+
|
|
255
|
+
### `to_parquet()`
|
|
256
|
+
Guarda la parcela o metaparcela como un archivo Parquet.
|
|
257
|
+
|
|
258
|
+
**Argumentos**:
|
|
259
|
+
|
|
260
|
+
`filename (str)`: El nombre del archivo Parquet a guardar.
|
|
261
|
+
|
|
262
|
+
**Devuelve**:
|
|
263
|
+
|
|
264
|
+
Un archivo con el `filename`.
|
|
265
|
+
|
|
266
|
+
# Y esta librería... ¿Cómo se usa?
|
|
267
|
+
¡Buena pregunta! Os dejo algunos ejemplos:
|
|
268
|
+
|
|
269
|
+
```python
|
|
270
|
+
from escatastrolib import Municipio, Calle, ParcelaCatastral, MetaParcela
|
|
271
|
+
from escatastrolib.utils import listar_provincias, listar_tipos_via, listar_calles, listar_municipios
|
|
272
|
+
|
|
273
|
+
print(listar_provincias())
|
|
274
|
+
# > ['A CORUÑA', 'ALACANT', 'ALBACETE', 'ALMERIA', 'ASTURIAS', 'AVILA', 'BADAJOZ', ...]
|
|
275
|
+
|
|
276
|
+
print(listar_tipos_via())
|
|
277
|
+
# > {'AC': 'ACCESO', 'AG': 'AGREGADO', 'AL': 'ALDEA, ALAMEDA', 'AN': 'ANDADOR', 'AR': 'AREA, ARRABAL', 'AU': 'AUTOPISTA', 'AV': 'AVENIDA', ... }
|
|
278
|
+
|
|
279
|
+
print(listar_municipios(provincia='Granada'))
|
|
280
|
+
# > ['AGRON', 'ALAMEDILLA', 'ALBOLOTE', 'ALBONDON', 'ALBUÑAN', 'ALBUÑOL', 'ALBUÑUELAS', 'ALDEIRE', ...]
|
|
281
|
+
|
|
282
|
+
print(listar_municipios(provincia='Granada', municipio='B'))
|
|
283
|
+
# > ['ALBOLOTE', 'ALBONDON', 'ALBUÑAN', 'ALBUÑOL', 'ALBUÑUELAS', 'BAZA', 'BEAS DE GRANADA', 'BEAS DE GUADIX', ...]
|
|
284
|
+
|
|
285
|
+
print(listar_calles(provincia='Granada', municipio = 'Baza'))
|
|
286
|
+
# > ['CL PARAISO (BAU)', 'CL A ALTOS', 'CL A PAVON', 'CL ABAD NAVARRO', 'PZ ABASTOS', 'CL ABEDUL', 'CL ABELARDO LOPEZ DE AYALA', 'CL ABENAMAR', 'CL ACEQUITA', 'CL ADARVE MONJAS', 'CL ADMINISTRADOR', 'TR ADUANA', 'CL ADUANA', 'CL AGUILA', 'CL AIRE', 'CL AIXA', ...]
|
|
287
|
+
|
|
288
|
+
municipio = Municipio(provincia='Granada')
|
|
289
|
+
# [!] Exception: Error al asignar municipio. No has especificado el municipio. Estos son los municipios disponibles: AGRON,ALAMEDILLA,ALBOLOTE,ALBONDON ...
|
|
290
|
+
|
|
291
|
+
municipio = Municipio(provincia='Granada', municipio='B')
|
|
292
|
+
# [!] Exception: Error al asignar municipio. No has especificado el municipio completamente. Estos son los municipios disponibles con esa búsqueda: ALBOLOTE,ALBONDON,ALBUÑAN,ALBUÑOL,ALBUÑUELAS,BAZA,BEAS DE GRANADA, ...
|
|
293
|
+
|
|
294
|
+
municipio = Municipio(provincia='Granada', municipio='Baza')
|
|
295
|
+
# [OK] {'provincia': 'Granada', 'municipio': 'BAZA'}
|
|
296
|
+
|
|
297
|
+
calle = Calle(municipio=municipio)
|
|
298
|
+
# [!] Exception: Error al asignar calle. No has especificado la calle. Estas son las calles disponibles: CL PARAISO (BAU),CL A ALTOS,CL A PAVON,CL ABAD NAVARRO,PZ ABASTOS,CL ABEDUL,CL ABELARDO LOPEZ DE AYALA, ...
|
|
299
|
+
|
|
300
|
+
calle = Calle(municipio=municipio, nombre_calle= 'M')
|
|
301
|
+
# [!] Exception: Error al asignar calle. No has especificado la calle completamente, o ese nombre está en varios lados (indica el tipo de vía que aparezca al principio de la vía como PZ o CL). Estas son las calles disponibles con esa búsqueda: CL ABENAMAR,CL ADARVE MONJAS,CL ADMINISTRADOR,CL ALAMEDA,CL ALAMILLOS,CL ALAMILLOS ALTOS,CL ALAMILLOS BAJOS,CL ALAMO,CL ALGAMASILLA,CL ALHAMBRA,...
|
|
302
|
+
|
|
303
|
+
calle = Calle(municipio=municipio, nombre_calle='Mayor', tipo_via='PL')
|
|
304
|
+
# [!] ErrorServidorCatastro: Error del Catastro. NO HAY COINCIDENCIAS EN LA BÚSQUEDA DE VÍAS
|
|
305
|
+
|
|
306
|
+
calle = Calle(municipio=municipio, nombre_calle='Mayor', tipo_via='PZ')
|
|
307
|
+
# [OK] {'calle': 'MAYOR', 'tipo_via': 'PZ', 'municipio': <ESCatastroLib.models.Municipio.Municipio at 0x7f0075209e10>}
|
|
308
|
+
|
|
309
|
+
pc = ParcelaCatastral(rc='22113U490470815583UK')
|
|
310
|
+
# [!] ErrorServidorCatastro: Error del Catastro. NO EXISTE NINGÚN INMUEBLE CON LOS PARÁMETROS INDICADOS
|
|
311
|
+
|
|
312
|
+
pc = ParcelaCatastral(rc='28067A023001490000FJ')
|
|
313
|
+
# [OK] {'rc': '28067A023001490000FJ', 'url_croquis': 'https://www1.sedecatastro.gob.es/CYCBienInmueble/SECImprimirCroquisYDatos.aspx?refcat=28067A023001490000FJ', 'municipio': 'GUADALIX DE LA SIERRA', 'provincia': 'MADRID', 'tipo': 'Rústico', 'parcela': '149', 'poligono': '23', 'nombre_paraje': 'PE¥ARRUBIA', 'regiones': [{'descripcion': 'PRADOS O PRADERAS', 'superficie': '250266'}, {'descripcion': 'MONTE BAJO', 'superficie': '187652'}, {'descripcion': 'PASTOS', 'superficie': '1814'}], 'centroide': {'x': '40.76845', 'y': '-3.672895'}, 'geometria': [{'x': '40.764879', 'y': '-3.678524'}, {'x': '40.765874', 'y': '-3.678059'}, ...], 'superficie': 439732.0}
|
|
314
|
+
|
|
315
|
+
pc = ParcelaCatastral(rc='1541506VK4714B0002PK')
|
|
316
|
+
# [OK] {'rc': '1541506VK4714B0002PK', 'url_croquis': 'https://www1.sedecatastro.gob.es/CYCBienInmueble/SECImprimirCroquisYDatos.aspx?refcat=1541506VK4714B0002PK', 'municipio': 'MADRID', 'provincia': 'MADRID', 'tipo': 'Urbano', 'calle': 'CL ALFONSO XII', 'numero': '34', 'antiguedad': '1915', 'uso': 'Almacen-Estacionamiento.Uso Residencial', 'regiones': [{'descripcion': 'APARCAMIENTO', 'superficie': '37'}, {'descripcion': 'ELEMENTOS COMUNES', 'superficie': '2'}], 'centroide': {'x': '40.414193', 'y': '-3.689266'}, 'geometria': [{'x': '40.414358', 'y': '-3.689164'}, {'x': '40.414359', 'y': '-3.689094'}, {'x': '40.414288', 'y': '-3.689092'}, ...], 'superficie': 39.0}
|
|
317
|
+
|
|
318
|
+
pc = ParcelaCatastral(provincia='Granada', municipio='Baza', poligono=16, parcela=128)
|
|
319
|
+
# [OK] {'provincia': 'GRANADA', 'municipio': 'BAZA', 'poligono': '16', 'parcela': '128', 'rc': '18024A016001280000GY', 'url_croquis': 'https://www1.sedecatastro.gob.es/CYCBienInmueble/SECImprimirCroquisYDatos.aspx?refcat=18024A016001280000GY', 'tipo': 'Rústico', 'nombre_paraje': 'BAICO', 'regiones': [{'descripcion': 'LABOR O LABRADÍO REGADÍO', 'superficie': '14608'}], 'centroide': {'x': '37.544352', 'y': '-2.742683'}, 'geometria': [{'x': '37.543611', 'y': '-2.74347'}, {'x': '37.543717', 'y': '-2.743522'}, {'x': '37.543945', 'y': '-2.743435'}, ...], 'superficie': 14608.0}
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
pc = ParcelaCatastral(provincia='Madrid', municipio='Madrid', poligono='1', parcela='1')
|
|
323
|
+
# [!] ErrorServidorCatastro: Error del Catastro. Esta parcela tiene varias referencias catastrales. Usa un objeto MetaParcela.
|
|
324
|
+
|
|
325
|
+
mp = MetaParcela(provincia='Madrid', municipio='Madrid', poligono='1', parcela='1')
|
|
326
|
+
# [OK] {'provincia': 'Madrid', 'municipio': 'Madrid', 'poligono': '1', 'parcela': '1', 'parcelas': [<ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7f61b2298040>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7f61b13407f0>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7f61b223a830>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7f61b223a350>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7f61b13400a0>]}
|
|
327
|
+
|
|
328
|
+
pc = ParcelaCatastral(provincia='Granada', municipio='Guadix', tipo_via='CL', calle='Largacha', numero=6)
|
|
329
|
+
# [!] ErrorServidorCatastro: Error del Catastro. Esta parcela tiene varias referencias catastrales. Usa un objeto MetaParcela.
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
pc = ParcelaCatastral(provincia='Granada', municipio='Guadix', tipo_via='PZ', calle='Catedral', numero=1)
|
|
333
|
+
# [OK] {'provincia': 'GRANADA', 'municipio': 'GUADIX', 'calle': 'PZ CATEDRAL', 'numero': '1', 'rc': '8085801VG8288E0001FA', 'url_croquis': 'https://www1.sedecatastro.gob.es/CYCBienInmueble/SECImprimirCroquisYDatos.aspx?refcat=8085801VG8288E0001FA', 'tipo': 'Urbano', 'antiguedad': '1750', 'uso': 'Religioso', 'regiones': [{'descripcion': 'RELIGIOSO', 'superficie': '3308'}], 'centroide': {'x': '37.301262', 'y': '-3.136249'}, 'geometria': [{'x': '37.301298', 'y': '-3.136662'}, {'x': '37.301316', 'y': '-3.136699'}, {'x': '37.301376', 'y': '-3.136711'}, ...], 'superficie': 3308.0}
|
|
334
|
+
|
|
335
|
+
mp = MetaParcela(provincia='Granada', municipio='Guadix', tipo_via='CL', calle='Largacha', numero=6)
|
|
336
|
+
# [OK] {'provincia': 'Granada', 'municipio': 'Guadix', 'calle': 'Largacha', 'numero': 6, 'parcelas': [<ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7ff4441944c0>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7ff44507e770>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7ff444194160>, <ESCatastroLib.models.InfoCatastral.ParcelaCatastral object at 0x7ff44507e110>]}
|
|
337
|
+
|
|
338
|
+
# Convertir a DataFrame
|
|
339
|
+
df = pc.to_dataframe()
|
|
340
|
+
|
|
341
|
+
# Exportar a JSON
|
|
342
|
+
pc.to_json("parcela.json")
|
|
343
|
+
|
|
344
|
+
# Exportar a CSV
|
|
345
|
+
pc.to_csv("parcela.csv")
|
|
346
|
+
|
|
347
|
+
# Exportar a Shapefile
|
|
348
|
+
pc.to_shapefile("parcela.shp")
|
|
349
|
+
|
|
350
|
+
# Exportar a Parquet
|
|
351
|
+
pc.to_parquet("parcela.parquet")
|
|
352
|
+
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
# ¿Cómo puedo contribuir?
|
|
356
|
+
Sigue las instrucciones de CONTRIBUTING.md y el Código de Conducta.
|
|
357
|
+
|
|
358
|
+
# Agradecimientos
|
|
359
|
+
- Al Catastro por hacer un Endpoint público.
|
|
360
|
+
- A GISCE-TI por currarse [una librería similar][1], basándose en los endpoints JSON.
|
|
361
|
+
- A mi abuelo y mi tío por pedirme que os eche una mano buscando tierras.
|
|
362
|
+
- A [Juanlu Cano][2] por darme la idea de extender el primer concepto en la PyConES para convertirlo en esta librería.
|
|
363
|
+
- A [Jaime Gómez-Obregón][3] por animar de forma muuuy indirecta a "hackear las Administraciones públicas".
|
|
364
|
+
|
|
365
|
+
[1]: https://github.com/gisce/pycatastro
|
|
366
|
+
[2]: https://github.com/astrojuanlu
|
|
367
|
+
[3]: https://github.com/JaimeObregon
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ESCatastroLib/__about__.py,sha256=PuXwBmOCJGK6hxYIwWPm-Ki1Xz1PMvA_xxj6qppHPsc,131
|
|
2
|
+
ESCatastroLib/__init__.py,sha256=QCXZ5qTCAGhkZr63i0Y7zZpkLKd342edUzjt9U_Ujqs,220
|
|
3
|
+
ESCatastroLib/models/Calle.py,sha256=TfgJfRiCSl6Fgug2--Wo2x5cj6JQdhHQojtZDZOgVSo,2846
|
|
4
|
+
ESCatastroLib/models/InfoCatastral.py,sha256=H8Eo96OThC_OSnpQ7Jeuwo4We5f1XZ4C51lbvcDUSq4,23308
|
|
5
|
+
ESCatastroLib/models/Municipio.py,sha256=J3X9G7EMc63651EDAMOqo846Ed-5cVjJfZLZeohPw74,1566
|
|
6
|
+
ESCatastroLib/models/__init__.py,sha256=Y8nN1Qp3_-VX7njuXwFWSq-62clHj878miEQGnzNXlc,149
|
|
7
|
+
ESCatastroLib/utils/__init__.py,sha256=kQj0ORkR_JMgwWgGi73APqn3p-UQipiuMY1QaBBmkLs,106
|
|
8
|
+
ESCatastroLib/utils/converters.py,sha256=cxjesg23z0gxhaquuPaEQjhgb2Gnj5Ip2BqX_n3wY0s,2621
|
|
9
|
+
ESCatastroLib/utils/exceptions.py,sha256=YM3AuKHZ61SYgpmtYFz9n7JavdEOq2mLwyk2VzIol5A,759
|
|
10
|
+
ESCatastroLib/utils/statics.py,sha256=PpHPS-lopMYWg5pJeeCU5NtIJU6nUpeh9njFFKwfVfc,3958
|
|
11
|
+
ESCatastroLib/utils/utils.py,sha256=WdtW7NqkFH0erkqRXbPAQRJQmJXezSjbD6mmJK8OZ-4,8436
|
|
12
|
+
escatastrolib-0.0.1rc2.dist-info/METADATA,sha256=ydQzIvNmx8I0sm8eCNoqJFPu3B0_JHFJeS0bznBUhyo,18066
|
|
13
|
+
escatastrolib-0.0.1rc2.dist-info/WHEEL,sha256=tkmg4JIqwd9H8mL30xA7crRmoStyCtGp0VWshokd1Jc,105
|
|
14
|
+
escatastrolib-0.0.1rc2.dist-info/licenses/LICENSE,sha256=kgDY5GRu9WGoKk_0F0iYmXuLmGiZ9hgtReHhCfJBWr8,11319
|
|
15
|
+
escatastrolib-0.0.1rc2.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Iván Valero Rodríguez
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|