Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OGR LVBAG Driver ignores field "verkortenaam" in OpenbareRuimte feature type #4286

Closed
justb4 opened this issue Aug 22, 2021 · 1 comment
Closed

Comments

@justb4
Copy link
Contributor

justb4 commented Aug 22, 2021

Expected behavior and actual behavior.

@yorickdewid

The LVBAG Driver reads the feature type "openbareruimte" (is like Eng. "thoroughway", usually a "street" with a streetname). The main field is "naam" (name). In some cases this FT contains an abbreviated name, known as "verkorte openbare ruimte naam".
We expect this field to show in the resulting features .e.g. the PostGIS table "openbareruimte".

Below is an example feature XML .

        <sl:stand>
            <sl-bag-extract:bagObject>
                <Objecten:OpenbareRuimte>
                    <Objecten:identificatie domein="NL.IMBAG.Openbareruimte">0221300000311195</Objecten:identificatie>
                    <Objecten:naam>Schout bij Nacht Doormansingel</Objecten:naam>
                    <Objecten:type>Weg</Objecten:type>
                    <Objecten:status>Naamgeving uitgegeven</Objecten:status>
                    <Objecten:geconstateerd>N</Objecten:geconstateerd>
                    <Objecten:documentdatum>2009-01-20</Objecten:documentdatum>
                    <Objecten:documentnummer>BAG/OBR20080001</Objecten:documentnummer>
                    <Objecten:ligtIn>
                        <Objecten-ref:WoonplaatsRef domein="NL.IMBAG.Woonplaats">2142</Objecten-ref:WoonplaatsRef>
                    </Objecten:ligtIn>
                    <Objecten:voorkomen>
                        <Historie:Voorkomen>
                            <Historie:voorkomenidentificatie>1</Historie:voorkomenidentificatie>
                            <Historie:beginGeldigheid>2009-01-20</Historie:beginGeldigheid>
                            <Historie:tijdstipRegistratie>2010-12-15T10:57:31.000</Historie:tijdstipRegistratie>
                            <Historie:BeschikbaarLV>
                                <Historie:tijdstipRegistratieLV>2010-12-15T11:02:21.484</Historie:tijdstipRegistratieLV>
                            </Historie:BeschikbaarLV>
                        </Historie:Voorkomen>
                    </Objecten:voorkomen>
                    <Objecten:verkorteNaam>
                        <nen5825:VerkorteNaamOpenbareRuimte>
                            <nen5825:verkorteNaam>Sbn Doormansingel</nen5825:verkorteNaam>
                        </nen5825:VerkorteNaamOpenbareRuimte>
                    </Objecten:verkorteNaam>
                </Objecten:OpenbareRuimte>
            </sl-bag-extract:bagObject>
        </sl:stand>

As can be seen the abbreviated name is even nested, e.g.

<Objecten:verkorteNaam>
  <nen5825:VerkorteNaamOpenbareRuimte>
     <nen5825:verkorteNaam>Sbn Doormansingel</nen5825:verkorteNaam>
  </nen5825:VerkorteNaamOpenbareRuimte>
</Objecten:verkorteNaam>

Steps to reproduce the problem.

  • Read a BAG source XML into any format, e.g. PostGIS.
  • Observe that the field "verkorteNaam" is never present in "Openbareruimte" table

Operating system

Any.

GDAL version and provenance

Latest Docker image as on aug 22, 2021.

Proposed Solution

This issue and its solution is very similar to issue #4161 and its PR #4168.
i.e. a new Field definition (String) needs to be added in ogrlvbaglayer.cpp from L289 on, plus tests.
Only complicating factor is the nested definition, so I expect that additional parsing is required in the function
ogrlvbaglayer.StartElementCbk.

...But it looks like OGR parses recursively until a matching element-name is found (?).
So hopefully it is just enough to define the new field as "verkorteNaam" by just adding:

        OGRFieldDefn oField3("verkorteNaam", OFTString);
@justb4
Copy link
Contributor Author

justb4 commented Aug 23, 2021

I can make the PR. Main question remaining: quoting from above:

...But it looks like OGR parses recursively until a matching element-name is found (?).
So hopefully it is just enough to define the new field as "verkorteNaam" by just adding:

OGRFieldDefn oField3("verkorteNaam", OFTString);

Would that be enough to extract from this element field XML-construct?

<Objecten:verkorteNaam>
  <nen5825:VerkorteNaamOpenbareRuimte>
     <nen5825:verkorteNaam>Sbn Doormansingel</nen5825:verkorteNaam>
  </nen5825:VerkorteNaamOpenbareRuimte>
</Objecten:verkorteNaam>

Could anyone confirm? @yorickdewid or @rouault ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant