3

Problem

I would like to have access to cadastral data (= land parcels) of Spain in vector format, so I can do further processing on them and put them into a database. I tried to do this multiple ways, none successful so far. My attempts are below.


WFS attempt

There is the Servicios INSPIRE de Cartografía Catastral webpage, listing ways to access Spanish cadastral data.

The listed WFS link is: http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx?. However, when add this source to QGIS as a WFS layer, I get this error message:

enter image description here

There is also the Descripción del servicio link. Using that, I figured I might need to use this link: http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx?Version=2.0.0. I can add this to QGIS via Layer -> Add Layer -> Add WFS Layer..., and seem to be able to connect to the service:

enter image description here

I Add, but then if I zoom to Spain in canvas, I get:

enter image description here

ie the error message:

Layer cp:CadastralParcel: Download of features for layer cp:CadastralParcel failed or partially failed: Server generated an exception in GetFeature response: Area of extension out of limits. You may attempt reloading the layer with F5


ATOM attempt

I downloaded the INSPIRE Atom Client Plugin. Installed it using steps from this answer. Then, using https://www.catastro.minhap.es/webinspire/index_eng.html I tried to add both of these links:

enter image description here

ie

as a layer to QGIS via Web -> INSPIRE Atom Client -> INSPIRE Atom Client, insert link, then Get Metadata (Atom).

Using the first link I get the error:

enter image description here

while the second one leads to:

enter image description here


Question

How can I solve the issues above or access Spain's land parcel data otherwise?

My main aim is to be able to download parcel data in vector format (that's why I'm trying the WFS and not the WMS service).

8
  • 1
    You need to zoom in further, request for scales smaller than 1:5000 seem to be denied. And the request limit is rather low it seems, so downloading data for large areas will take a long time.
    – Erik
    Jul 29, 2022 at 11:27
  • WFS has no scale limit - I can get it to give me all 3 polygons but they are off the coast of Kenya ragrdless of the combination of ignore axis order/invert axis order I set
    – Ian Turton
    Jul 29, 2022 at 11:34
  • 1
    your comment @IanTurton sounds like a mismatch in the CRS. Could this be something to look into?
    – Vincé
    Aug 3, 2022 at 9:19
  • Did you contact the agency to ask them what the problem might be?
    – Babel
    Aug 3, 2022 at 9:56
  • 1
    This request works but returns only 84 features ovc.catastro.meh.es/INSPIRE/…. I could get the same 84 features also with QGIS but I suppose there are more parcels in Spain. The service has rather strict limits catastro.minhap.es/webinspire/documentos/inspire-cp-WFS.pdf which make it hard to do bulk dowloads. That's obviously intentional.
    – user30184
    Aug 3, 2022 at 20:32

3 Answers 3

2
+200

Maybe the best that you can do is to collect the download links manually from the Atom feeds. There is one link per municipality but you must find them in two steps.

First, read the source code of the main page

view-source:https://www.catastro.minhap.es/INSPIRE/CadastralParcels/ES.SDGC.CP.atom.xml

From this page you can find links for the territories, for example Territorial office 04 Almería:

view-source:https://www.catastro.minhap.es/INSPIRE/CadastralParcels/04/ES.SDGC.CP.atom_04.xml

The territory pages have the download links, for example 04004-ALBANCHEZ Cadastral Parcels

http://www.catastro.minhap.es/INSPIRE/CadastralParcels/04/04004-ALBANCHEZ/A.ES.SDGC.CP.04004.zip

Browsers will tell that the link is not safe because it uses http instead of https. If you bypass the message you will get a zip that contains parcels as a GML file, in this case A.ES.SDGC.CP.04004.cadastralparcel.gml. QGIS opens the file and geometries and attributes look good to me.

enter image description here

1
  • This method works for 99+% of municipalities. In some rare cases, the zip file includes a vector file not having any features, and in some other cases the gml file seems to be corrupt and QGIS does not read it. Incredibly close to perfect.
    – zabop
    Aug 9, 2022 at 11:28
2

There is a PDF document about the WFS service at https://www.catastro.minhap.es/webinspire/documentos/inspire-cp-WFS.pdf. The service has some restrictions

Retricciones:

• CP:CadastralParcel se limita a 1 km2 de extensión y a 5000 elementos

• CP: CadastralZoning se limita a la extensión de 25 km2 y a 500 elementos

• No se admiten consultas SQL en general

These restrictions are not included in the GetCapabilities http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx?service=WFS&Version=2.0.0&request=GetCapabilities

The restrictions mean that the GetFeature request must have a BBOX that in not bigger than 1 km2 for cadastral parcels. This is something that does not belong to the WFS standard and therefore the generic WFS clients like QGIS or GDAL are totally unaware about it. However, it is possible to browse the data with QGIS even it is not possible to download all the parcels of Spain with it.

enter image description here

Connect the service and select the feature type. It is important to get some of the supported CRS codes into the Coordinate Reference System box. Unfortunately I do not know how it can be done in a reliable way. I managed with it by pressing the Connect button several times.

enter image description here

. The list of supported coordinate systems is in the GetCapabilities:

<DefaultCRS> urn:ogc:def:crs:EPSG::4326</DefaultCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::4258</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::25829</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::25830</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::25831</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3785</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3857</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3035</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3041</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3042</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::3043</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::32627</OtherCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::32628</OtherCRS>
<OtherCRS>urn:ogc:def:crs:CRS::84</OtherCRS>

Make sure that option "Only request features overlapping the view extent" is selected. Zoom in close enough so that the 1 km2 limit is not exceeded (actually server is not very strict with the limit, but very slow it is). You need to open some helper layer into QGIS in order to know where to zoom. With these setting QGIS loads more parcels each time when you pan the map. Try to avoid zooming out more than to scale 1:10000 because then the server may start to send timeouts. Here is a screen capture to confirm that it is possible to use that service with WFS for browsing the data. However, it is not possible to download and save all parcels of Spain from the WFS with QGIS.

enter image description here

1

You can achieve that in the command line using ogr2ogr that is part of gdal library as follows:

Getting WFS service info

ogrinfo WFS:http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx? -so

Downloading data to shapefile (you can use another format to suit your needs)

ogr2ogr -f "ESRI Shapefile" wfs_spain.shp WFS:"http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx" CadastralParcel
1
  • The method is right but due to restrictions on the server side the result is not good: Feature Count: 84.
    – user30184
    Aug 4, 2022 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.