Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- ES-MD: find RECINTO.shp wherever the archive puts it
- REST converters: a variant may name its own service (es_ib keeps its yearly editions in a second one), the id-bound query is retried, and a joined layer's table prefixes are stripped for every converter
- REST converters: page by id windows instead of server-side sorting, key cached pages by service as well as layer, discover the qualified key field on joined layers, and never keep an error response or a broken download as a cached page
- ES-CB: editions 2010-2025, Cantabria's own licence instead of CC-BY-NC, and the province named as provider
- ES-IB: editions 2022-2026 (the yearly layers moved to the GOIB_SIGPAC_HISTORIC_IB service), the provider is the Balearic government, not Navarra's, and the joined field names are handled by the REST mixin
- Update vecorel-cli to v0.2.17:
- GeoJSON is read as UTF-8 as the format mandates, instead of the platform locale (cp1252 on Windows mangled umlauts)
Expand Down
20 changes: 12 additions & 8 deletions fiboa_cli/datasets/es_cb.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ class ESCBConverter(EsriRESTConverterMixin, ESBaseConverter):
short_name = "Spain Cantabria"
title = "Spain Cantabria Crop fields"
description = "SIGPAC Crop fields of Spain - Cantabria"
# https://www.caib.es/sites/M170613081930629/f/463418
# see https://intranet.caib.es/opendatacataleg/dataset/sigpac-2024/resource/3a0bc2e0-3f37-45b7-a7d4-1e8c7cf09bc8
# "Our licenses allow the reproduction or redistribution of the licensed digital information to third parties. In such cases, it is essential that when redistributing or transferring the data to said third parties, they clearly and explicitly accept the conditions of our non-commercial use license."
license = "CC-BY-NC-4.0" # http://www.opendefinition.org/licenses/cc-by
# Not Creative Commons: Decreto 87/2013 (modified by 102/2018) defines two
# licences of its own, both free of charge, the commercial one needed only
# for reselling. The service names no licence, only the copyright holder.
# https://www.territoriodecantabria.es/cartografia-sig/descargas-y-politica-de-licencias/preguntas-frecuentes
license = "Licencia de uso de datos del Gobierno de Cantabria (Decreto 87/2013) <https://www.territoriodecantabria.es/cartografia-sig/datos-abiertos-y-politica-de-licencias>"
# The wording the licence requires for original data, verbatim.
attribution = (
Government of Cantabria. Free information available at https://mapas.cantabria.es"
Gobierno de Cantabria. Información gratuita disponible en https://mapas.cantabria.es"
)
provider = ""
provider = "Gobierno de Cantabria <https://mapas.cantabria.es>"
columns = {
"DN_OID": "id",
"geometry": "geometry",
Expand All @@ -35,18 +37,20 @@ class ESCBConverter(EsriRESTConverterMixin, ESBaseConverter):
}
}

variants = {str(year): str(year) for year in range(2024, 2010 - 1, -1)}
variants = {str(year): str(year) for year in range(2025, 2010 - 1, -1)}
use_code_attribute = "USO_SIGPAC"
use_variant_as_determination = True
Comment thread
ivorbosloper marked this conversation as resolved.

# "https://geoservicios.cantabria.es/inspire/rest/services/SIGPAC/MapServer?f=json"
# "https://geoservicios.cantabria.es/inspire/rest/services/SIGPAC/MapServer/63/query?f=json&where=1%3D1&spatialRel=esriSpatialRelIntersects&geometry=%7B%22xmin%22%3A407913.2828037373%2C%22ymin%22%3A4804384.359524686%2C%22xmax%22%3A411054.4224193499%2C%22ymax%22%3A4805366.49482229%2C%22spatialReference%22%3A%7B%22wkid%22%3A25830%2C%22latestWkid%22%3A25830%7D%7D&geometryType=esriGeometryEnvelope&inSR=25830&outFields=OBJECTID%2CPROVINCIA%2CMUNICIPIO%2CAGREGADO%2CZONA%2CPOLIGONO%2CPARCELA%2CRECINTO%2CUSO_SIGPAC%2CSHAPE_Area&orderByFields=OBJECTID%20ASC&outSR=25830"

# 2010-2014 are joined layers, whose fields arrive table-qualified
# (SIGPAC_2014_ATRRE.USO_SIGPAC); the REST mixin strips the prefixes.
rest_base_url = "https://geoservicios.cantabria.es/inspire/rest/services/SIGPAC/MapServer"
# rest_params = {"where": "USO_SIGPAC NOT IN ('AG','CA','ED','FO','IM','IS','IV','TH','ZC','ZU','ZV','MT')"}

def rest_layer_filter(self, layers):
if not self.variant:
self.variant = next(iter(self.variants))
self.column_additions["determination:datetime"] = ""
regex = re.compile("Recintos SIGPAC " + self.variant)
return next(layer for layer in layers if regex.match(layer["name"]))