Show markers on the map

24 views
Skip to first unread message

Giuseppe Riccardi

unread,
Sep 10, 2025, 3:40:48 AM (12 days ago) Sep 10
to GeoAdminCh API
Hello all,

me and my team would like to display two markers (given coordinates) and a line connecting them both. Is this possible using geoAdmin? And if yes which layers should I use?
Is there someone that can provide a simple example?

Thanks a lot or your support.
Giuseppe

Pascal Barth

unread,
Sep 10, 2025, 3:56:35 AM (12 days ago) Sep 10
to geoadm...@googlegroups.com
Hi Giuseppe,

You could use a KML to describe the geometry you want to display, and then add it to the map through a URL parameter.
Are you planning on providing that embedded in another website/app? Here's a simple example of what I'm describing: https://map.geo.admin.ch/#/map?layers=KML|https://public.geo.admin.ch/api/kml/files/Qbe05UjLRDmQBaIMEkYs8Q (you could then fine-tune the position/zoom by using the `z` and `center` params, if needed)

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/ab93e4c4-0743-48ee-a81a-1c587d07de56n%40googlegroups.com.

Giuseppe Riccardi

unread,
Sep 10, 2025, 11:42:38 AM (11 days ago) Sep 10
to GeoAdminCh API
Hi Barth,

thanks for your reply. Is it possible to load a KML dynamically? For what I understood this  KML|https://public.geo.admin.ch/api/kml/files/Qbe05UjLRDmQBaIMEkYs8Q is a statical file created using the drawing option inside map.geo.admin.ch. What I would like is integrate map.geo.admin.ch  map in another website and be able to load a KML created by my website or suing other APIs (maybe from api3.geo.admin.ch). 
Is it possible? How can I do it?

Thanks again,
Giuseppe

Pascal Barth

unread,
Sep 10, 2025, 11:48:13 AM (11 days ago) Sep 10
to geoadm...@googlegroups.com
Hi Giuseppe,

You can load any KML files, as long as it is hosted on a HTTPS and CORS enabled website.
You could also create a local KML and then load it, but that only works if you are using the map.geo.admin.ch UI to add it to the map (and access your local files through the browser dedicated API).

So if your goal is to generate content on-demand for your website, creating and hosting the KML on your own website might be the best solution. You can then show it through our embedded view, if you want to minimize the amount of UI elements on the map.

KML is essentially a specialized XML (you can a beginner's guide here: https://developers.google.com/kml/documentation/kml_tut )
If you want to have the same "styling" as the drawing mode of map.geo.admin.ch, you need to add `@style=geoadmin` at the end of the layers URL param, so something like https://map.geo.admin.ch/#/map?layers=KML%7Chttps://public.geo.admin.ch/api/kml/files/Qbe05UjLRDmQBaIMEkYs8Q@style=geoadmin

Cheers,
Pascal


Giuseppe Riccardi

unread,
Sep 11, 2025, 6:41:14 AM (10 days ago) Sep 11
to GeoAdminCh API
Hello Barth,

thanks for the explanation. I will proceed to create an HTTPS endpoint to create an KML file and try it with the map.

Best regards,
Giuseppe

Reply all
Reply to author
Forward
0 new messages