Help on Super Simple Use Case

42 views
Skip to first unread message

Michael Bischof

unread,
Jun 16, 2023, 3:23:33 AM6/16/23
to GeoAdminCh API
I am reading through the API documentation and thought this should be easy as ordering a pizza.

What I need: coordinates of a Swiss address given, e.g. Lindenmattstrasse 15, 5616 Meisterschwanden
(and then calculate the distance to a fixed building but there are tons of nice python scripts around to do this as soon as I have the coordinates).

What's the appropriate api command?


Michael

Jürgen Hansmann

unread,
Jun 16, 2023, 8:54:37 AM6/16/23
to GeoAdminCh API
Hi Michael

Probably you can use some of this Python snippets here, that make use of swisstopo's services:
This one retrieves coordinates for a given address: https://github.com/hansmannj/py-tutorial/blob/master/solutions/adresse.py 
You could additionally user the "sr" parameter to get the response in e.g. LV03 or LV95, which would be easier for the distance calculcation.

For the distance calculation, as simple example would be this: https://github.com/hansmannj/py-tutorial/blob/master/solutions/koordinaten.py (ignore the conversion part of the Python example).
This are just some very simple example scripts based on simplified calculations that do not take the curvature of earth into account.
So probably not suitable, if you need exact numbers. But at least you can see which services might be useful for you to start digging.

Cheers and have a nice weekend
Juergen

Jürgen Hansmann

unread,
Jun 16, 2023, 10:14:08 AM6/16/23
to geoadm...@googlegroups.com
Sorry, forgot to add a link to where you can find details on the sr parameter: https://api.geo.admin.ch/services/sdiservices.html#search
--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geoadmin-api/73153975-0f06-4d5d-8f71-58b71a644633n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages