Browse Source

data-ingest: Create a spatial index on the building geodata

nin/deploy
Félix Baylac-Jacqué 7 months ago
parent
commit
2890656b8a
  1. 8
      data-ingest/ingest
  2. 16
      notes.org

8
data-ingest/ingest

@ -15,7 +15,7 @@ clean_tmp () { @@ -15,7 +15,7 @@ clean_tmp () {
}
trap clean_tmp EXIT
echo "[+] Ingesting IPE ata."
echo "[+] Ingesting IPE data."
echo " The following files will be ingested."
echo ""
ipeFiles=$(find "${fullIpeDirPath}" -name '*.csv')
@ -53,7 +53,13 @@ UPDATE ipe SET ImmeubleGeoPoint = @@ -53,7 +53,13 @@ UPDATE ipe SET ImmeubleGeoPoint =
2154)
,4326);
EOF
sqlite3 "${fullDbPath}" < "${tmpSql}"
echo "[+] Creating Rtree index (spatial index). We're almost done."
cat > "${tmpSql}" <<EOF
SELECT load_extension("mod_spatialite");
SELECT CreateSpatialIndex('ipe','ImmeubleGeoPoint');
EOF
sqlite3 "${fullDbPath}" < "${tmpSql}"
echo "[+] SQLite database generated at ${fullDbPath}"

16
notes.org

@ -46,3 +46,19 @@ @@ -46,3 +46,19 @@
** DSPs to Ingest
ADTH AISN BEFO BTHD CTYF EURE FI44 NATH NIVE NPDC SART SHSN SIEL SPTH VAUC
** Requête sur l'Index Spatial
#+BEGIN_SRC sql
SELECT * FROM ipe
WHERE ROWID = (
SELECT ROWID FROM SpatialIndex
WHERE f_table_name = 'ipe'
AND search_frame = BuildMBR(
-1.405456066131592,
43.53722495535158,
-1.3643002510070803,
43.54475322429539,
4326)
);
#+END_SRC

Loading…
Cancel
Save