Geonovum / PDOK-NGR-documentatie

MIT License
12 stars 21 forks source link

Limits are not identical for all features #20

Open melvyn-sopacua opened 7 years ago

melvyn-sopacua commented 7 years ago

(This may be an issue with bag:woonplaats itself, as it's the only MultiPolygon)

There are a number of things concerning limits:

  1. ogr2ogr ignores them and strips them from the WFS url. I have not found a way to set a count and start index with arguments to ogr2ogr.
  2. feature count property and actual feature count differ
  3. The number of features provided for bag:woonplaats is 1000

Observe:

>>> with open('woonplaats.json.bak', 'rt') as f:
...     res = json.load(f)
...
>>> res.keys()
dict_keys(['features', 'type', 'crs', 'totalFeatures'])
>>> res.get('totalFeatures')
2501
>>> type(res.get('features'))
<class 'list'>
>>> len(res.get('features'))
1000
>>> feats = res.get('features')
>>> for feat in feats:
...     if feat['properties']['woonplaats'] == 'Amsterdam':
...         print(feat['properties']['identificatie'])
...
>>>

Not using ogr2ogr, we fetch in batches of 500:

#!/bin/sh
count=500
start=0
basedir=`dirname $0`
base_url='http://geodata.nationaalgeoregister.nl/bag/wfs?service=WFS&version=2.0.0&request=GetFeature&typename=bag:woonplaats&outputformat=json'
max=2600

while [ ${start} -lt ${max} ]
do
        url="${base_url}&startindex=${start}&count=${count}"
        curl --silent -o ${basedir}/${start}.json "${url}"
        start=$((${start} + ${count}))
done

Result:

% grep -rl Amsterdam test/*.json
test/1000.json
test/2000.json

So, in the geoserver software the disconnect between featureCount and actual features delivered needs to be fixed, but docs should warn about this as well.