GeoAdmin API Assistance: Coordinates and Altitude Retrieval

51 views
Skip to first unread message

Saravana Kumar

unread,
Dec 2, 2024, 1:48:29 AM12/2/24
to GeoAdminCh API

I used this endpoint:

https://api3.geo.admin.ch/rest/services/api/SearchServer?searchText=Veia%20da%20Lai%2015%207440%20Andeer&origins=address,zipcode&type=locations
to get the latitude and longitude information.

Response:

{ "results": [ { "attrs": { "detail": "veia da lai 15 7440 andeer 3701 andeer ch gr", "featureId": "190177223_0", "geom_quadindex": "030332001220331220113", "geom_st_box2d": "BOX(752083.7385821516 163395.43022642954,752083.7385821516 163395.43022642954)", "label": "Veia da Lai 15 <b>7440 Andeer</b>", "lat": 46.60449981689453, "lon": 9.42383861541748, "num": 15, "objectclass": "", "origin": "address", "rank": 7, "x": 163395.4375, "y": 752083.75, "zoomlevel": 10 }, "id": 1402518, "weight": 100 } ] }

Point 2:

Using the latitude and longitude above, I made another request to the endpoint:
https://api3.geo.admin.ch/rest/services/ech/MapServer/identify?layers=all:ch.kantone.cadastralwebmap-farbe&sr=4326&geometry=9.42385,46.60447&geometryFormat=geojson&geometryType=esriGeometryPoint&limit=2&tolerance=0&returnGeometry=true&lang=en

Response:

{ "results": [ { "type": "Feature", "featureId": 377807, "bbox": [ 9.423647, 46.604311, 9.424065, 46.604556 ], "layerBodId": "ch.kantone.cadastralwebmap-farbe", "layerName": "CadastralWebMap", "id": 377807, "geometry": { "type": "Polygon", "coordinates": [ [ [9.423649, 46.604368], [9.423657, 46.604397], [9.423702, 46.604562], [9.424063, 46.604499], [9.424004, 46.604304], [9.423649, 46.604368] ] ] }, "properties": { "ak": "GR", "number": "666", "identnd": "GR0000003701", "egris_egrid": "CH415672077747", "realestate_type": null, "geoportal_url": "geogr.mapplus.ch/viewer/geogr/?lang=de&basemap=av&blop=1&x=2762500&y=1170000&zl=1&hl=0&layers=bodenbedeckung|gwr_address|lokalisationsplan|coord_grid|coord_grid_white|av_wms_bw|av_wms_yellow|rutschgebiete|av_fpnr|geb_nummer_nichtoffizell|bb_proj|ls_proj|gde_grenzen|av_stand&op=0.5|1|1|1|1|1|1|1|1|1|1|1|1|0.5", "label": "GR" } } ] }

I want to know how to get the altitude for this location from the GeoAdmin.ch API. I know about the altitude service here:
https://api3.geo.admin.ch/services/sdiservices.html, but I got stuck when trying to use it.

To use the altitude service, it requires the easting and northing coordinates in LV03 (EPSG:21781) or LV95 (EPSG:2056).

Can anyone provide a clear explanation on how to get the altitude using the GeoAdmin.ch API?

Pascal Barth

unread,
Dec 12, 2024, 5:21:01 AM12/12/24
to geoadm...@googlegroups.com
Hi,

If you already know the coordinates in LV95 of your point, you can simply run this request : https://api3.geo.admin.ch/rest/services/height?easting={x}&northing={y}
In case you only know the coordinates in Mercator, you can use any projection lib to help you go back and forth, and can find LV95 configuration for your tool here : https://epsg.io/2056 (we are using proj4 mainly, and there you can find the definition you need to give proj4 to add support for LV95)
To see it in action, you can open up map.geo.admin.ch and your network tab (of the dev tools) and right click somewhere on the map.

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/52cf4ded-933f-42a2-acea-01734ee0b936n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages