osdatahub icon indicating copy to clipboard operation
osdatahub copied to clipboard

Issue running Python Example from OS Data Hub Explorer

Open mikey-heatgeek opened this issue 2 years ago • 1 comments

I am trying to run a code snipped from https://labs.os.uk/prototyping/data-hub-explorer/

from osdatahub import NGD, Extent

key = "INSERT_API_KEY_HERE"
bbox = (-1.5017, 50.9946, -1.5001, 50.9955)
extent = Extent.from_bbox(bbox, "EPSG:4326")

collection = "bld-fts-buildingpart"
ngd = NGD(key, collection)
result = ngd.query(extent=extent)

When running in Python I get:

ERROR:root:{
    "code": 400,
    "description": "Intersection geometry 'POLYGON ((-1.5001 50.9946, -1.5001 50.9955, -1.5017 50.9955, -1.5017 50.9946, -1.5001 50.9946))' is outside the spatial extent of collection 'Building Part v1'. If the given geometry is within a supported CRS, please use the filter-crs parameter. The following coordinate reference systems are supported: http://www.opengis.net/def/crs/OGC/1.3/CRS84, http://www.opengis.net/def/crs/EPSG/0/27700, http://www.opengis.net/def/crs/EPSG/0/4326, http://www.opengis.net/def/crs/EPSG/0/3857",
    "help": "https://osdatahub.os.uk/docs/ofa/technicalSpecification"
}

I have osdatahub-1.2.4 installed

mikey-heatgeek avatar May 11 '23 15:05 mikey-heatgeek

This was resolved changing the argument of the CRS:


bbox = (-1.5017, 50.9946, -1.5001, 50.9955)
extent = Extent.from_bbox(bbox, "CRS84")

collection = "bld-fts-buildingpart"
ngd = NGD(key, collection)
result = ngd.query(extent=extent)

But still hopefully that can be updated in the defaults of the app :)

mikey-heatgeek avatar May 11 '23 15:05 mikey-heatgeek