Skip to content

How to use the MakeSnapshot Script

mtbeek32 edited this page Mar 3, 2023 · 2 revisions

This page describes how to use the BAG20_MakeSnaphot.dms script to make a BAG20 MakeSnapshot.

date configuration

Make sure your %SourceDataDir%/BAG/date/FSS folder contains FSS folders for each BAG object type, resulting from BAG20 Xml2FSS.

Then configure the code lines (in the top of the BAG20_MakeSnapshot.dms scriptfile):

// te configureren
parameter<string> BAG_Date            := '20230113';
parameter<string> Snapshot_Date_Input := '20230101';
//

Adapt the BAG_Date to the date for the downloaded BAG source, also configured as date in the BAG20 Xml2FSS script. The source FSS files for making the snapshot will now be read from the FSSDir, configured as:
'%SourceDataDir%/BAG20/' + BAG_Date + '/fss';
If the results of BAG20 Xml2FSS are saved in another folder, adjust also the FSSDir.

The Snapshot_Date_Input defines for which date the snapshot is made. Always chose a date before the BAG_Date.

For both parameters use the yyyymmdd format. In this example the BAG data was downloaded at the 13th of January 2023 from which a snapshot is made for the 1th of January 2023.

After opening the BAG20_MakeSnaphot.dms script in the GeoDMS GUI, the snapshots folder contains a set of examples for generating a snapshot, with different options. A template MakeSnapshot is configured for each example with as first parameter always the date for which the snapshot is made.

The other parameters define the snapshot options, described in the next paragraphs.

snapshot options configuration

The following options need to be configured for a snapshot.

geographic selection (second parameter)

If the second parameter is configured to False, the snapshot is generated for the whole of the Netherlands.

To configure a geographic selection, set this second to True.

A geographic selection can be configured in two ways:
  1. Use an ESRI polygon shapefile:
    The easiest way is to replace the file ./data/geo_sel.shp in your project folder with the ESRI polygon shapefile you want to use for the selection. If you want to keep this file at another location, you can also adjust the StorageName configured for the geo_selectie item to refer to this location.

  2. Define a rectangle (all vbo's and related objects within the rectangle will be selected):
    By default this ways of selecting is in comments and not active. First uncomment the codeblock starting with nrofrows = 1 till the comment: // Voorbeeld voor het lezen van een geo_selectie uit een shape file

    And comment the codeblock starting with : StorageName = "%ProjDir%/data/geo_sel.shp" till container typeringen.

Next set the The x_min, x_max, _y_min _and y_max parameters for the requested extent in the container: geo_selectie/pointset. These parameters now describe the selection rectangle to be used.

In both cases we advice to configure the Label parameter to a clear name of your selected area. This label will become a subfolder in the resulting snapshot folder

status selection (third parameter)

The BAG contains (meta) information on the states of objects. Selections can be made on the states, for instance to exclude buildings still under construction.

If the third parameter is configured as False, the snapshot is generated for all states of all objects. To configure a snapshot with state selections, set this third parameter to True.

The states selections can be viewed and or adapted with the data items: typeringen/status/objecttype/selected, e.g. typeringen/status/pand/selected to select the states for panden.

The default selection states are derived from the Vesta project (October 2018).

filter strange values, expected data errors (fourth parameter)

Although the quality of the BAG increases, still data errors do occur. In the snapshot you can choose to filter out 'strange values', probable data errors. This is advised in most cases, unless you want to use the snapshot for solving data errors in the BAG.

Configure this parameter to True to filter the probable data errors and False to keep the probable errors in the snapshot.

The current version of the filtering, filters on tree aspects:
  1. The area of panden should be smaller than 10.0000.000 square meters, such large panden are unlikely and cause problems in deriving the woonpand_type attribute.
  2. The length and width of the panden should be smaller than 5000 meters, such panden are also unlikely.
  3. The centroid of the panden should be located in the Netherlands.

Other filters can be added.

height information (fifth parameter)

Information on the height of panden can be added to the snapshot. Configure the fourth argument to True if height information is desired and to False if not so.

The height information is derived from the PHN (Pand Hoogtes Nederland) database, which is derived from the AHN.

See requirements for PHN before making a snapshot with height information.

format (sixth parameter)

The sixth parameter indicates the format of the resulting snapshot. The current version of this scripts supports two options:

  1. FSS: generates all resulting data as a set of FSS folders. This is advised if the resulting data is used in other GeoDMS projects.
  2. GPKG: generates one GeoPackage file with tables for all BAG objecttypes, including code tables to limit the data size and make selections easier. The GPKG is advised if the resulting snapshot also is used in other software, like QGIS.

Configure the format parameter to FSS or GPKG.

generating a snapshot

As mentioned, the snapshots folder contains a set of examples for generating a snapshot. Select one of these options, adapt it if necessary or make a copy with your requested options and give it a unique name.

After selection a snapshot example or configuring your own, open this container in the GeoDMS GUI, e.g. the item: snapshots/nl_status_sel_with_strangevalues_no_height_fss

To generate the snapshot double click one of the following items :

  • MaakVolledigeSnapshot: generates a full snapshot with all objecttypes from the BAG in the configured format (FSS, GPKG).
  • MaakAlleenFSSAdressenTabel: generates only the addresses table (used for geocoding) (FSS format only).

Especially the MaakVolledigeSnapshot option can take some time.

result

The resulting snapshot becomes a folder in your %SourceDataDir%/BAG/snapshots.ext/optional_geo_selection_name/date.new folder. This can contain a set of FSS folders (with .dmsdata files) or the GPKG file.

We advice to rename the resulting folder to a %SourceDataDir%/BAG20/snapshots.ext/optional_geo_selection_name/date folder

Clone this wiki locally