Main question. How built heritage affects real estate market in European cities?


Let’s look at this question on the example of Barcelona. Let’s single out the city neighborhoods (barrios) where historical buildings are located, and analyze the ratio of average real estate prices to them, in particular, the sale prices of apartments and houses.

As a next step, we could analyze the average condition factor of heritage buildings inside and the built environment by city neighborhood and predict how the average price per square meter would change if heritage renovation programs were applied.


  1. Evaluate the best way of creating a real estate prices dataset by testing API and scraping approaches, finally get a dataset with sufficient data entries,
  2. Calculate the price per sqm per each data entry in the real estate prices dataset,
  3. Match the real estate prices dataset with the Barcelona neighborhood shapefile, calculate mean, max, min and average price per sqm,
  4. Fetch heritage points and polygons from openstreetmap, create isochrones of them 100, 400 and 800 m,
  5. Fetch buildings data from the public cadastre, categorize them by heritage-like and not (already 50 years old buildings could fit the built heritage policy requirements), cluster buildings, make buffers 400m, match amount of heritage-like buildings with the Barcelona neighborhood shapefile,
  6. Make a correlation between mean, max, min and average price per sqm and heritage buffer zones, heritage-like buffer zones,
  7. Evaluate the hypothesis, check the data on conditions of heritage buildings in non-correlated zones,

Data and tools

We are going to use a fetched by map of building footprints from the official public cadastre web site, scraped data of real estate sales, heritage sites and points from osm map, neighborhood boundaries of Barcelona from the Geography Institute of Catalonia,
It is known that Idealista and Fotocasa are the top real estate web portals. In order to compare results and select the best way, we are going to achieve listings’ data with scraping and API procedures.
data sources:
openstreet map
Institut Cartogràfic i Geològic de Catalunya
public cadastre of Spain – Spain real estate web portal #1 – Spain real estate web portal #2


 Idealista API + Selenium +  Pandas +  Geopandas +  Numpy +  Folium + BeautifulSoup + OSMNX + Matplotlib + Plotly + Networks + PyTorch + Mapbox API


Dataset retrieved by the Idealista and Idealista2 API procedure with grading by 10 natural jenks
Dataset retrieved by the Idealista and Idealista2 API procedure with grading by 10 natural jenks. Zoom on Barcelona municipality.

Retrieving data via Idealista API, 50 entries max per 1 request, max 100 requests free per month, so max 100*50 = 500 entries maximum for a dataset could be achieved gratis per a month. Idealista2 API provides gratis 50 entries max per 1 request, max 500 requests free per month, so max 500*50 = 2500 entries for a dataset are available. So, next we try use the previously scraped dataset from

Dataset achieved by scraping procedure with grading by 10 natural jenks
Hexagon histogram of aggregated prices per sqm in Barcelona

Merging data from with Barcelona neighborhoods we achieve amount of listings, minimum, maximum, average, mean, medium prices.

analysis of residential real estate sales by neighborhood (barrio) of Barcelona
Spatial lag of mean prices by neighborhood

Spatial lag indicates largest demand for real estate in neighborhoods La Dreta and Les Cortes.

From price by neighborhood analysis we can definitely identify neighborhoods with the largest sale flux of homes, the most expensive and the most cheap neighborhoods. Finally, we are going to clusterize listings on a map.

K-means clustering of listings by Price/sqm
Cluster break down shows shares, 69% to cheap and mid-cheap offers, 24% to mid+ offers, and 1.3% to extra-expensive offers.
Buffers zones of openstreetmap-sourced heritage points (orange) and polygons (blue)

Next step, we make isochrones of heritage sites taken from the openstreetmap. First, we used only the osm point-geometry heritage.

Isochrones of heritage sites 5, 10, 20 min walk

Let’s select 10-min walk isochrones for the correlation with prices per sqm of homes achieved from

Categorizing real estate prices in heritage 10-min walk isochrones of Barcelona

As we can see the darkest, id est the highest mean prices are concentrated in Barcelonetta, Gothic Quartier and further to Passeig Gracia. Although not all heritage isochrones contain equal values. There is still an ample room for improving correlation with addition of polygon heritage isochrones, but let’s switch to another analysis by building age/real estate price.

Buildings ranged by year of construction
Correlation of housings older 100 years and hottest (more average by Barcelona) mean prices from


After conducting various analyses of the Barcelona case, a clear outcome is emerging: there is a steadily correlation between built heritage and the real estate market. Over 50% of all residential buildings are older 50 years that automatically fits to the built-heritage age according to EU regulations. Even without considering additional parameters such as the renovation status of a building or the urban environment, this case study demonstrates that the highest price-to-square-meter ratio is consistently observed, particularly in terms of the mean and maximum ratios.