nlextract / NLExtract

Convert (ETL) and visualize free Dutch geo-datasets.
https://nlextract.nl
GNU General Public License v3.0
149 stars 84 forks source link

Gebruik het GfsPreparationFilter in de BRK verwerking #375

Closed justb4 closed 3 months ago

justb4 commented 4 months ago

Zie ook BGT ETL en de discussie in PR #373. Dit Stetl Filter is (nog) onderdeel van NLExtract en zorgt voor versnelling in the verwerking van de BRK in de "ogr2ogr" stap door de bestaande BRK GFS file steeds te optimaliseren vlak voor deze verwerking.

Implementatie Schets

Analoog aan BGT. In etl-brk.cfg

[etl]
chains = input_sql_pre|schema_name_filter|output_postgres,
         input_zip_file|extract_zip_file|handle_orl|handle_pand|prepare_gfs|output_ogr2ogr,
         input_sql_post|schema_name_filter|output_postgres

.
.
# Prepare the generic GFS file to optimize the loading speed
[prepare_gfs]
class = stetlcomponents.gfspreparationfilter.GfsPreparationFilter
input_gfs = {gfs_template}
justb4 commented 3 months ago

Hmm, de GFS preparation filter lijkt niets te doen: de output GFS is identiek aan de bron GFS file: alle Feature types zitten er in en zie geen FeatureCounts. De output lijkt ok, wordt bijv Perceel gevonden met count 8288359:

2024-03-27 16:58:15,516 gfspreparationfilter INFO start preparing GFS
2024-03-27 16:58:15,516 gfspreparationfilter INFO calling ogrinfo
2024-03-27 17:05:24,558 gfspreparationfilter INFO parsing ogrinfo output
2024-03-27 17:05:24,562 gfspreparationfilter INFO 
{b'Perceel': 8288359}
2024-03-27 17:05:24,562 gfspreparationfilter INFO preparing XSLT template
2024-03-27 17:05:24,562 gfspreparationfilter INFO transforming input GFS
2024-03-27 17:05:24,569 gfspreparationfilter INFO writing output GFS
2024-03-27 17:05:24,570 gfspreparationfilter INFO preparing GFS done

Maar temp/fromzip-tmp.gfs met in die map ook temp/fromzip-tmp.gml (de 25GB Perceel.gml) is dus identiek aan de NLExtract versie brk/etl/gfs/brk.gfs.

(Tijdens hond uitlaten...)

Aha, wat ik dacht: voorheen werkte het ook, alleen toen had [output_ogr2ogr] gfs_template parameter. Die overschrijft nu natuurlijk het resultaat van de GFS preparation filter...Die parameter verwijderen (net als BGT config). En ja nu werkt het, steeds 1 FeatureClass en met FeatureCount: bijv met testdata:

<GMLFeatureClassList>
  <GMLFeatureClass>
    <Name>KadastraleGrens</Name>
    <ElementPath>KadastraleGrens</ElementPath>
    <GeometryType>2</GeometryType>
    <SRSName>urn:ogc:def:crs:EPSG::28992</SRSName>
    <DatasetSpecificInfo>
      <FeatureCount>10</FeatureCount>
      <ExtentXMin>10000</ExtentXMin>
      <ExtentXMax>280000</ExtentXMax>
      <ExtentYMin>300000</ExtentYMin>
      <ExtentYMax>625000</ExtentYMax>
    </DatasetSpecificInfo>
justb4 commented 3 months ago

Opgelost, alleen is het bij verwerking hele BRK maar 5% tijdwinst.