Repository navigation
feat: WGS84 geometry and lookup by object_id - #208
Merged
Merged
Conversation
GET /api/v1/geometry returned footprints and surfaces only in the dataset's storage CRS (EPSG:25832 in Germany, EPSG:28992 in the Netherlands). A caller passing them to an EPSG:4326 API without PostGIS of its own had no way to reproject them. srid=4326 now reprojects the footprint and any surfaces in the query with ST_Transform before ST_AsGeoJSON, so the GeoJSON has WGS84 longitude and latitude and no crs member, as RFC 7946 expects. The footprint stays 2D and surfaces keep their height. Without the parameter nothing changes; any other srid value is a 400 naming the value, before any database lookup.
GET /api/v1/buildings found buildings only by PyLovo OSM id or by bbox. A caller that keys buildings by their 3D object id, including buildings with no OSM way, had to fetch a bbox and filter it. object_ids is a third mode, after osm_ids and before the bbox in precedence. It returns the named buildings, linked or not, each once and with the fields of the other modes: a linked building carries its best way, osm_ids and match_type 1, one without an OSM match empty ways and match_type 2, and one with no building_link row yet empty ways and match_type 0. Unknown ids return nothing.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two additions to the read endpoints, for a caller that works on the 3D buildings themselves rather than their OSM counterparts.
Change
GET /api/v1/geometry?srid=4326reprojects the footprint and any surfaces to WGS84 in the query (ST_TransformbeforeST_AsGeoJSON). The GeoJSON then has longitude and latitude and nocrsmember, as RFC 7946 expects. The footprint stays 2D and surfaces keep their height. Without the parameter the output is unchanged (storage CRS, named incrs). Any othersridvalue is a 400 naming the value, returned before any database lookup.GET /api/v1/buildings?object_ids=is a third mode next toosm_idsand the bbox. It returns the named 3D buildings, linked to PyLovo or not, each once, with the fields of the other modes (surfaces,function_code,number_of_storeys):osm_idosm_idsmatch_type[][]Unknown ids return nothing. When several modes are given,
osm_idswins, thenobject_ids, then the bbox.Docs:
docs/api.md, the OpenAPIgetBuildingsandgetGeometryoperations, andCHANGELOG.md.The two features are separate commits.
Tests
TestServe_GeometryInWGS84: with WGS84, the footprint is 2D longitude/latitude in Bavaria with nocrsmember, and every surface position has a height. The default stays in EPSG:25832 with acrsmember.TestGeometry_RejectsUnsupportedSRID:sridvalues 3857, 25832 andwgs84give a 400 naming the value. Onmainthe request goes on to the database lookup.TestServe_BuildingsByObjectIDs: a building linked to two ways, one without an OSM match, one with no link row and an unknown id give the rows in the table above. Each known building carries its surfaces and function code.go vet ./...,go test -race ./...and the integration tests for process, db, importer, api and onrequest pass locally. A local server against the German and Dutch demo databases returned WGS84 footprints and surfaces for both countries, and theobject_idsrows above for a linked and an unmatched building.