from osgeo import gdal, ogr, osr
url = 'http://ovc.catastro.meh.es/INSPIRE/wfsCP.aspx?service=wfs&version=2&request=getfeature&STOREDQUERIE_ID=GetParcel&srsname=EPSG:4326&REFCAT=%s'
wfs_drv = ogr.GetDriverByName('WFS')
wfs_ds = wfs_drv.Open('WFS:' + url % refcat)
layer = wfs_ds.GetLayerByName('cp:CadastralParcel')
feat = layer.GetFeature(0)
geom = feat.GetGeometryRef()
# Realizamos transformación para invertir los ejes
source = osr.SpatialReference()
source.ImportFromProj4('+proj=latlong +datum=WGS84 +axis=neu +wktext')
target = osr.SpatialReference()
target.ImportFromProj4('+proj=latlong +datum=WGS84 +axis=enu +wktext')
transform = osr.CoordinateTransformation(source, target)
geom.Transform(transform)
# Obtenemos atributos o geometría
area = feat['areaValue']
geomJson = geom.ExportToJson()
Created
February 15, 2018 11:40
-
-
Save fpsampayo/6be7235efa9ac8b35ea2ceebec9d1dfe to your computer and use it in GitHub Desktop.
Catastro INSPIRE desde GDAL/OGR
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment