gzileni / overturemaps_italy

an extraction of the first release of data made by OvertureMaps Foundation for each italian region script&data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

overturemaps italy

On this page you will find the links to the data extraction of the first release of OvertureMaps Foundation and all the scripts needed to replicate the operation.
The data version is Release Overture 2023-07-26-alpha.0.
The license for buildings is ODbL, while for places it is CDLA-Permissive 2.0.
The data is enriched with ISTAT ids and released in geopackage format.
In this repository there is also the dataset of the non-generalized Italian municipal borders at 2023 of ISTAT (CC-BY license) in geoparquet format.

prerequisites

just duckdb

data download

note: the coordinate reference system is EPSG:4326

places

  1. Abruzzo 16Mb
  2. Basilicata 5.9Mb
  3. Calabria 19.8Mb
  4. Campania 61.3Mb
  5. Emilia-Romagna 53.5Mb
  6. Friuli Venezia-Giulia 13.8Mb
  7. Lazio 66.2Mb
  8. Liguria 20.1Mb
  9. Lombardia 96.9Mb
  10. Marche 20.2Mb
  11. Molise 3.2Mb
  12. Piemonte 46.2Mb
  13. Puglia 44.9Mb
  14. Sardegna 19.9Mb
  15. Sicilia 53.4Mb
  16. Toscana 51.3Mb
  17. Trentino Alto Adige 15.7Mb
  18. Umbria 11.5Mb
  19. Valle d'Aosta 2.3Mb
  20. Veneto 55.8Mb

buildings

  1. Abruzzo 66.1Mb
  2. Basilicata 49.9Mb
  3. Calabria 96.4Mb
  4. Campania 197.3Mb
  5. Emilia-Romagna 509.0Mb
  6. Friuli Venezia-Giulia 248.5Mb
  7. Lazio 290.6Mb
  8. Liguria 200.3Mb
  9. Lombardia 640.9Mb
  10. Marche 94.8Mb
  11. Molise 20.4Mb
  12. Piemonte 473.8Mb
  13. Puglia 662.0Mb
  14. Sardegna 235.5Mb
  15. Sicilia 347.0Mb
  16. Toscana 512.0Mb
  17. Trentino Alto Adige 125.1Mb
  18. Umbria 46.7Mb
  19. Valle d'Aosta 24.9Mb
  20. Veneto 925.7Mb

process

prepare the data

Install AWS CLI and download the data
If you want download all

aws s3 cp --region us-west-2 --no-sign-request --recursive s3://overturemaps-us-west-2/release/2023-07-26-alpha.0/ <DESTINATION>

To download single themes:

  • admins
    s3://overturemaps-us-west-2/release/2023-07-26-alpha.0/theme=admins
  • buildings
    s3://overturemaps-us-west-2/release/2023-07-26-alpha.0/theme=buildings
  • places
    s3://overturemaps-us-west-2/release/2023-07-26-alpha.0/theme=places
  • transportation
    s3://overturemaps-us-west-2/release/2023-07-26-alpha.0/theme=transportation

process description

all data is incorporated into a duckdb file on which the following SQL operations are then performed

  • extraction from the downloaded parquet files into a duckdb table taking into account the bounding box of Italy with a buffer of 5km
  • from the created table, a new table is created with a selection of columns so that each contains only one value. E.g. for names you choose the languages of Italian, English, German and French
  • the table is enriched with new columns corresponding to ISTAT codes through a spatial relationship with the geometries of Italian municipalities
  • based on these attributes, data are extracted at the level of each Italian region

execution

prepare data

bash script

duckdb omf_italy -c ".read 00_prepare_tables_istat.sql"

create geopackages of the places for earch region of Italy

bash script

duckdb omf_italy -c ".read 01_extraction_places_italy.sql"

create geopackages of the buildings for earch region of Italy

duckdb omf_italy -c ".read 02_extraction_buildings_italy.sql"

assign the SRS to each file

bash script

for i in `ls *.gpkg`;
  do
    name=`basename $i .gpkg`;
    tmpname=`echo $name`_tmp.gpkg;
    echo "assign WGS84 to $i";
    ogr2ogr -a_srs EPSG:4326 -f "GPKG" $tmpname $i;
    mv $tmpname $i;
    echo "done!";
done

creation of geoparquet files

bash script

wget https://github.com/planetlabs/gpq/releases/download/v0.11.0/gpq-linux-amd64.tar.gz
tar xfvz gpq-linux-amd64.tar.gz 
chmod 755 gpq
regions="abruzzo basilicata calabria campania emiliaromagna friuliveneziagiulia lazio liguria lombardia marche molise piemonte puglia sardegna sicilia toscana trentinoaltoadige umbria valledaosta veneto"
url="https://s3.eu-central-1.amazonaws.com/overturemaps.italy/"
placeslbl="places_"
gpkglbl=".gpkg"
parquetlbl=".parquet"
buildingslbl="buildings_"
for r in $regions 
do
	d="$url$placeslbl$r$gpkglbl"
	wget $d
	duckdb -c "load spatial;CREATE TABLE $placeslbl$r as select * from st_read('$placeslbl$r$gpkglbl', layer='$placeslbl$r');ALTER TABLE $placeslbl$r  RENAME geom TO geometry;COPY  (SELECT * FROM $placeslbl$r ) TO 'tmp.parquet' (FORMAT PARQUET, CODEC 'ZSTD');"
	rm $placeslbl$r$gpkglbl
	./gpq convert tmp.parquet $placeslbl$r$parquetlbl
	rm tmp.parquet
done;
for r in $regions 
do
	d="$url$buildingslbl$r$gpkglbl"
	wget $d
	duckdb -c "load spatial;CREATE TABLE $buildingslbl$r as select * from st_read('$buildingslbl$r$gpkglbl', layer='$r');ALTER TABLE $buildingslbl$r  RENAME geom TO geometry;COPY  (SELECT * FROM $buildingslbl$r ) TO 'tmp.parquet' (FORMAT PARQUET, CODEC 'ZSTD');"
	rm $buildingslbl$r$gpkglbl
	./gpq convert tmp.parquet $buildingslbl$r$parquetlbl
	rm tmp.parquet
done;

About

an extraction of the first release of data made by OvertureMaps Foundation for each italian region script&data

License:Do What The F*ck You Want To Public License


Languages

Language:Shell 58.8%Language:Dockerfile 41.2%