Use Cadastral Layer in Google map

95 views
Skip to first unread message

marioka...@gmail.com

unread,
Nov 24, 2022, 12:43:14 PM11/24/22
to GeoAdminCh API
In our map we are using Swisstopo and Googlemaps. See here an example:  https://codepen.io/loicgasser/pen/LmOzYK

Now we would like to add the cadastral layer (https://s.geo.admin.ch/9bd6167fd8) in our Googlemaps. But the solution for GeoAdmin (var lyr2 = ga.layer.create(‘ch.kantone.cadastralwebmap-farbe') is not working with google.

Does somebody know how we can show the Cadastral layer from GeoAdmin in Google?

GeoAdminCh API

unread,
Nov 30, 2022, 5:08:23 AM11/30/22
to GeoAdminCh API

Hello,

You are right, the old GeoAdmin JS API is only working with the Swiss projection, LV03 or LV95, but all layers are also provided in a projection compatible with Google Maps.

The settings for the "CadastralWebMap" layer may be found in the OGC WMTS GetCapaibilites document: https://wmts.geo.admin.ch/EPSG/3857/1.0.0/WMTSCapabilities.xml (the full documentation for WMTS services is https://api3.geo.admin.ch/services/sdiservices.html#wmts)

I did rapidly update the example:

I hope it may help

Regards,


Marc

Maurizio Manca

unread,
Jan 26, 2023, 7:26:29 AM1/26/23
to GeoAdminCh API
I'm completely new to this world so forgive me if the question may sound naive
Can you add a layer from the WMS (i.e. ch.swisstopo.amtliches-gebaeudeadressverzeichnis) on top of one of the maps you have created in your example at https://codepen.io/procrastinatio/details/mdKGwbO ?
Should I use a Custom Overlay ? 

Marc Monnerat

unread,
Jan 26, 2023, 10:44:11 AM1/26/23
to geoadm...@googlegroups.com
Hello Maurizio, 

I'm not too familiar with the Google Maps API, but it's possible.

You simply have to create a new layer with:

const GebauedekarteType = new google.maps.ImageMapType({
  getTileUrl: getTileUrl,
  [...]
});


The crux is the getTileUrl function which should do WMS requests, and then add to the map as an overlay as you already said:

map.overlayMapTypes.insertAt(1, GebauedekarteType );

Normally, most if not all layers provided by the federal geospatial infrastructure are available as WMS and WMTS (see https://api3.geo.admin.ch/api/faq/index.html#which-layers-are-available)

I did extend my previous example: https://codepen.io/procrastinatio/details/jOpxQmw

Regards,

Marc

--
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/82771aca-3b1e-4efc-b73b-dfddcc39435cn%40googlegroups.com.


--
--
Всё идёт по плану

Maurizio Manca

unread,
Jan 26, 2023, 1:29:35 PM1/26/23
to GeoAdminCh API
Thanks a lot, that's exactly what I needed!
That getTileUrl with the correct URL was the thing I wasn't able to build.

I'll try to make it clickable in order to retrieve the info of the address. Unfortunately the click via Google Maps returns only existing addresses (the nearest to the click), while this layer contains the newer buildings too.

Thanks again

Maurizio

marioka...@gmail.com

unread,
Mar 23, 2023, 7:19:20 AM3/23/23
to GeoAdminCh API
Hi

Your Code works fine, thank you very much for your help.
We have seen, that in your example the tiles have an offset and are shifted, see attachment. So we have same issue on our end. Do you have any idea how to solve that issue?:

Screenshot 2023-03-23 121718.png

Regards
Mario

GeoAdminCh API

unread,
Mar 23, 2023, 8:56:17 AM3/23/23
to GeoAdminCh API
Hi Mario,

This is known issue on our side when using this layer in webmercator... use LV95

marioka...@gmail.com

unread,
Apr 16, 2023, 4:11:45 AM4/16/23
to GeoAdminCh API
Hi

Thank you very much. We use our maps also for areas outside of Switzerland and there we need maps like Google, so we can't change them to LV95. Do you have an idea, how we can use LV95 only for this map and for all other maps WGS84? Is it planned to solve this issue?

Regards
Mario

GeoAdminCh API

unread,
Apr 16, 2023, 9:46:47 AM4/16/23
to GeoAdminCh API
Hello Mario,

This is a long and well-known issue with WMTS, but the surveyors have no interests outside LV95 and hence it won't be fixed.

The only solution I came across, is to use the MO-Public WMS service, as a single image (no gutter issue across tiles :-) A few cantons are missing though.


ch.swisstopo-vd.amtliche-vermessung (OpenData-AV)
Die amtliche Vermessung (AV) beschreibt die Lage, die Form und den Inhalt eines Grundstückes. Die digitalen AV-Daten sind in mehreren thematischen Informationsebenen gegliedert, die frei miteinander kombiniert werden können. OpenData AV basiert auf dem Darstellungsdienst der amtlichen Vermessung welcher mit den Daten des AV-Geoportals des Bundes kreiert wird.

Here is an example with the GoogleMaps API

Hope it helps

Marc

marioka...@gmail.com

unread,
May 7, 2023, 5:05:40 AM5/7/23
to GeoAdminCh API
Hi Marc

Thank you for your feedback. The second version would be visually the better solution, but unfortunately, as you said, some cantons are missing. I still hope that the offset will be corrected some time.

Thank you very much for your help.

Best wishes
Mario

Reply all
Reply to author
Forward
0 new messages