nvdb-vegdata / nvdb-api-client

BSD-licensed open source Java library for consuming NVDB REST API
BSD 2-Clause "Simplified" License
13 stars 9 forks source link

Attributes for Driftskontrakt (580) #108

Open Taraskin opened 3 years ago

Taraskin commented 3 years ago

Provide attributes for Driftskontraktsområde (Datakatalog code = 580).

AreaClient.getContractAreas() method returns only limited set of properties - id, type, name, number, counties, municipalities.

RoadObjectClient.getRoadObjects() for featureTypeId = 580 returns only IDs, without a properties. At the same time web endpoint - https://nvdbapiles-v3.utv.atlas.vegvesen.no/vegobjekter/580/114142161: responds with:

<egenskaper>
    ...
    <egenskap>
        <id>8832</id>
        <navn>Type</navn>
        <egenskapstype>Tekstenum</egenskapstype>
        <datatype>FlerverdiAttributt, Tekst</datatype>
        <verdi>Driftskontrakt</verdi>
        <enum_id>11750</enum_id>
    </egenskap>
    <egenskap>
        <id>8833</id>
        <navn>Dato fra</navn>
        <egenskapstype>Dato</egenskapstype>
        <datatype>Dato</datatype>
        <verdi>2007-09-01</verdi>
    </egenskap>
    <egenskap>
        <id>8834</id>
        <navn>Dato til</navn>
        <egenskapstype>Dato</egenskapstype>
        <datatype>Dato</datatype>
        <verdi>2020-01-01</verdi>
    </egenskap>
    <egenskap>
        <id>5174</id>
        <navn>Navn</navn>
        <egenskapstype>Tekst</egenskapstype>
        <datatype>Tekst</datatype>
        <verdi>MIDTHORDALAND</verdi>
    </egenskap>
    <egenskap>
        <id>5175</id>
        <navn>Nr</navn>
        <egenskapstype>Heltall</egenskapstype>
        <datatype>Tall</datatype>
        <verdi>5</verdi>
    </egenskap>
</egenskaper>

Interested mostly in next properties: Navn - 5174 Nr - 5175 Type - 8832 Dato fra - 8833 Dato til - 8834

It would be also nice to have possibility receive attributes for multiple driftskontrakt at once, based on IDs in request, for example - it will reduce amount of requests to the service.

LtGlahn commented 3 years ago

This behaviour is due to the special treatmet of the 580 object in NVDB api LES. The 580 type "Kontraktsområde" is used to index all other features plus the road network ("vegnett/veglenkesekvenser/segmentert") with "kontraktsområde" information. Due to data volume, speed of indexing and the complexity in fully indexing 580 with itself, the 580-objecs have a very simplified representation in NVDB api LES.

I highly doubt a workaround (such as looping over the individual 580 objects in the initial response) will be implemented, but leave it open while we consider it.

Also, please bear in mind that very good workarounds exists for many of the use cases where it feels natural to download the 580 object:

Taraskin commented 3 years ago

Thank you for the response, @LtGlahn. As developers of the Brutus system (which is closely integrated with NVDB in both directions), we are very interested in getting some extra details for contracts, especially - dates, to determine if contract is expired - this is very important for us. So, as a quick solution/workaround, I hope - it is possible to put from/to date attributes among others into <kontraktsområde> section as part of <lokasjon> block for bridge information, something like:

<kontraktsområder>
 <kontraktsområde>
  <id>494270639</id>
  <nummer>805</nummer>
  <navn>0805 Rjukan 2015-2021</navn>
  <datefrom>2015-01-01</datefrom>
  <dateto>2021-12-31</dateto>
 </kontraktsområde>