swissboundaries3d-gemeinde-flaeche / 2025 version

41 views
Skip to first unread message

Mattia Manzoni

unread,
Jan 16, 2025, 2:54:37 AMJan 16
to GeoAdminCh API
Hello everypody I'm pleased to join the forum.

I have a question: I have the CH03 coordinates and I need tho retrieve the name of the municipality from the layer ch.swisstopo.swissboundaries3d-gemeinde-flaeche.fill.

I did a API call whit the Identify Features and I retrieve the JSON. The JSON file has more than 170 values because this layer reports for every year the name of the municipality.

Now I need to extract the value for the year 2025. The problem is that the position in the JSON file of this value change everytime.

For example for some municipality the 2025's name is in postion 8 of the JSON, for other municipality is in position 15. There is a way to obtain a JSON with the 2025  only version's of the layers?

I would thank you everybody that will help me.

Greetings from Ticino.
Mattia


Pascal Barth

unread,
Jan 16, 2025, 3:00:52 AMJan 16
to geoadm...@googlegroups.com
Hi Mattia,

Yes, that is possible and quite straightforward : you can add the param "timeInstant=2025" to your URL.
Sadly this is an undocumented param on https://api3.geo.admin.ch/ (hence why you might not have found it). I'll check if we can disclose this one, as it is quite useful.

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 visit https://groups.google.com/d/msgid/geoadmin-api/849f2e13-9c9b-4113-8a7c-470a25b0d07en%40googlegroups.com.

Mattia Manzoni

unread,
Jan 17, 2025, 5:06:22 AMJan 17
to GeoAdminCh API

Hello Pascal,

Thank you for your help! It works like a charm!

It would be great if there would be a parameter that reports always the latest version of the layer in order to avoid updating the API request each year (something like ‘timeInstant’=’current’).

By the way, you spare me a lot of headaches. Thank you & have a nice Friday + weekend.

Mattia

Reply all
Reply to author
Forward
0 new messages