Retrive building contour as polygon in geojson format

57 views
Skip to first unread message

Markus Boos

unread,
Jun 15, 2024, 5:22:36 AM6/15/24
to GeoAdminCh API
Hi

I'd like to retrieve the contour of a building in geojson format.

The goal is to have the contour for fire brigade incidents plan of sub-terrain parking in our municipality.


But this returns the geometry of type "Point".

How do I retrieve the contour as Polygon?
Does anybody have a hint or solution?

Thank you in advance & kind regards
Markus

Pascal Barth

unread,
Jun 17, 2024, 6:04:26 AM6/17/24
to geoadm...@googlegroups.com
Hi Markus,

You might find what you search on the layer "ch.swisstopo.vec25-gebaeude" using the point you received through your first request.
This other layer sadly doesn't link to the EGDI number, so you might receive more if buildings are "linked" together (and can't directly search with an EGID on it).

If I take the first building of your request, the second request would look like

The trick is, you need to run an identify request on this layer (and not a find) and that requires a bit more params and fine tuning. Here's how I achieve this URL :
- add tolerance=10 (pixels) to the request
- add a fake viewport of 10px x 10px with 96dpi : imageDisplay=10,10,96
- take the coordinate you receive and create a "fake" bbox with it by flooring the coordinates to the 4th decimal and ceiling to the 4th ( floorX, floorY, ceilX, ceilY ) : mapExtent=8.7952,47.3663,8.7953,47.3664
- change layer param to layers, and add a all: before the layer ID

Note that this layer (Vector25 buildings) is not updated anymore, and will not contain up-to-date data. We unfortunately don't provide a valid up-to-date alternative for ease of access to building shapes. You might get by by parsing all roofs on the solar potential layer (ch.bfe.solarenergie-eignung-daecher) but that will be quite cumbersome to build...

Hope I could point you in the right direction,

Cheers,
Pascal




--
You received this message because you are subscribed to the Google Groups "GeoAdminCh API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/8036959e-4682-4bd7-ac2f-523a5b5b55d2n%40googlegroups.com.

Markus Boos

unread,
Jun 17, 2024, 11:12:58 AM6/17/24
to GeoAdminCh API
Wow, Pascal! Highly appreciated.
Thank you very much for your support.

Your guidance is helpful and brought up some ideas.

Unfortunately, the needed information is spread over different systems.

The Geo Admin API has the Data, as it can provide the tiles and the building information (year of building, usage, ..)
The Overpass Service for OSM provides the required API functionality, But not (all) the wished data.

Kind regards,
Markus
Reply all
Reply to author
Forward
0 new messages