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

Bounding Boxes cover the planet #6979

Open
marklit opened this issue Nov 9, 2023 · 0 comments
Open

Bounding Boxes cover the planet #6979

marklit opened this issue Nov 9, 2023 · 0 comments

Comments

@marklit
Copy link

marklit commented Nov 9, 2023

$ mkdir -p meta

$ for FILENAME in `unzip -l 2023-10-31.zip | grep meta | grep -Eo '[a-z]{2}\/.*'`; do
      unzip 2023-10-31.zip $FILENAME -d meta/
  done

$ ipython
import json
from   pathlib import Path


def get_file_type(filename):
    if 'parcels' in filename:
        return 'parcels'

    if 'buildings' in filename:
        return 'buildings'

    if 'addresses' in filename:
        return 'addresses'

    return 'Unknown'


recs = []

for filename in Path('meta').rglob('*.geojson.meta'):
    rec = json.loads(open(filename).read())

    recs.append({
        'type': 'Feature',
        'properties': {**{key: val
                          for key, val in rec.items()
                          if key != 'bounds'},
                       **{'filename': str(filename),
                          'data_type': get_file_type(str(filename))}},
        'geometry': rec['bounds']})

with open('aggregate.geojson', 'w') as f:
    f.write(json.dumps({'type': 'FeatureCollection',
                        'features': recs}))

This is just the address bounding boxes:

addresses

I found a few examples that don't look to be using ESPG:4326

$ jq -S .bounds meta/us/ne/platte-addresses-county.geojson.meta
{
  "coordinates": [
    [
      [
        -1133.0434584,
        -1744.838695
      ],
      [
        88.5864698,
        -1744.838695
      ],
      [
        88.5864698,
        715.7039681
      ],
      [
        -1133.0434584,
        715.7039681
      ],
      [
        -1133.0434584,
        -1744.838695
      ]
    ]
  ],
  "type": "Polygon"
}

There are others that look to just use whole numbers for coordinates rather than the more granular values most records have.

$ jq -S .bounds meta/au/qld/brisbane_city_council-addresses-city.geojson.meta
{
  "coordinates": [
    [
      [
        -89.9710477,
        -86.9220497
      ],
      [
        0,
        -86.9220497
      ],
      [
        0,
        153.4656792
      ],
      [
        -89.9710477,
        153.4656792
      ],
      [
        -89.9710477,
        -86.9220497
      ]
    ]
  ],
  "type": "Polygon"
}

I filtered out some of the largest bounding boxes for the address datasets and it's revealing bounding boxes that stretch from the north to the south pole.

image

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