loreabad6 / masters-thesis-geotech

BNA-EU: Advances of my master thesis for the Erasmus Mundus Masters of Geospatial Technologies
3 stars 1 forks source link

Include a better way to extract the minimum area of analysis #1

Closed loreabad6 closed 5 years ago

loreabad6 commented 5 years ago

There are issues in the country script for example in the UK in Corby, where an additional LSOA is added in spite of intersecting with the OSM boundary.

      DROP TABLE IF EXISTS generated.sa_pop_grid;
      CREATE TABLE generated.sa_pop_grid AS
      SELECT l.cell_id, l.lsoa11nm, l.population, l.jobs, l.geometry
      FROM received.lsoa l, received.sa_boundary b
      WHERE ST_Intersects(l.geometry,b.geometry)
      AND ST_Area(ST_Intersection(l.geometry, b.geometry))>100000;

The same goes for the Netherlands, in Delft, one buurt does not show because of the way I call the data:

      CREATE TABLE generated.sa_pop_grid AS
      SELECT l.cell_id, l.bu_naam, l.population, l.jobs, l.geometry
      FROM received.nl_buurt l, received.sa_boundary b
      WHERE ST_Intersects(l.geometry, b.geometry)
      AND (ST_Area(ST_Intersection(l.geometry, b.geometry)) > 500000 
            OR ST_Contains(b.geometry, l.geometry));

Besides, I am not using a buffer around the study area as it increases it in area considerably, and would mean that I should include them within the downloaded OSM data. I keep the boundary feature mainly for the GEOSTAT data set for general use in Europe, but will take a look at the results when I add the US to the possible analyses and compare results with PFB.

loreabad6 commented 5 years ago

I changed the code for Delft to this:

      AND (ST_Area(ST_Intersection(l.geometry, b.geometry)) > 100000 
            OR ST_Contains(b.geometry, l.geometry));

But this is only a momentary solution, and does not work, for example, for Venlo.

loreabad6 commented 5 years ago

Fixed on https://github.com/loreabad6/masters-thesis-geotech/commit/ec8a676cf5dd77eba25f0c759e1b3eecc403e077 by working with the percentage of the area intersected, instead of the area of intersection itself. Will include this on all the codes for selecting areas inside the boundary:

      DROP TABLE IF EXISTS generated.sa_pop_grid;
      CREATE TABLE generated.sa_pop_grid AS
      SELECT l.cell_id, l.lsoa11nm, l.population, l.jobs, l.geometry
      FROM received.lsoa l, received.sa_boundary b
      WHERE ST_Intersects(l.geometry,b.geometry)
      AND (ST_Area(ST_Intersection(l.geometry, b.geometry))/
            ST_Area(l.geometry) > 0.7
            OR ST_Contains(b.geometry, l.geometry));

So before the fix I had this: before

And after: after