{"id":66,"date":"2020-07-31T14:33:55","date_gmt":"2020-07-31T14:33:55","guid":{"rendered":"http:\/\/100.26.179.211\/?p=66"},"modified":"2022-01-28T23:43:34","modified_gmt":"2022-01-28T23:43:34","slug":"remove-first-digit-from-swiss-coordinates","status":"publish","type":"post","link":"http:\/\/michaeltsmith.org.uk\/?p=66","title":{"rendered":"Remove first digit from Swiss Coordinates"},"content":{"rendered":"\n<p>Quick tip. I&#8217;m using data from air pollution sensors provided <a href=\"https:\/\/www.ostluft.ch\/index.php?id=aktuelle-luftqualitaet#messgroesse=0e9b81d7-e20d-483a-adb1-21ab4cbd0e75\">here<\/a>. The Koordinaten are of the form 2&#8217;710&#8217;500 \/ 1&#8217;259&#8217;810. These use the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Swiss_coordinate_system\">Swiss coordinate system<\/a>. pyproj is the defacto standard for doing coordinate processing, <a href=\"https:\/\/www.ia.arch.ethz.ch\/lat-lon-to-ch-coordinates\/\">this page<\/a> also helped.<\/p>\n\n\n\n<p>But I could make it work, those coordinate values were too big.<\/p>\n\n\n\n<p>Eventually I realised one needs to remove the leading 1 and 2 from the two numbers. This is mentioned in the wikipedia article:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><span class=\"has-inline-color has-vivid-red-color\">In<\/span> order to nonetheless achieve a clear distinction between the two systems, an additional digit was added to the coordinates of LV95: any East coordinate (E) now starts with a 2, and any North coordinate (N) with a 1. Consequently, LV95 coordinates are given by pairs of 7-digit numbers, whereas LV03 used pairs of 6-digit numbers \u2013 for instance the coordinates (2 600 000m E \/ 1 200 000m N) in LV95 would be expressed as (600 000m E \/ 200 000m N) in LV03.<\/p><cite>https:\/\/en.wikipedia.org\/wiki\/Swiss_coordinate_system<\/cite><\/blockquote>\n\n\n\n<p>In summary, my code now looks like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pyproj import Proj, transform\nsites = &#91;]\nsites.append({'name':'Zurich, Schimmelstrasse (ZH)','E':681942,'N':247245,'height':415})\nsites.append({'name':'Zurich, Heubeerib\u00fcel (ZH)','E':685126,'N':248460,'height':610})\npWorld = Proj(init='epsg:4326')\npCH = Proj(init='epsg:21781')\nfor site in sites:\n    print(transform(pCH,pWorld, site&#91;'E'], site&#91;'N']))<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Quick tip. I&#8217;m using data from air pollution sensors provided here. The Koordinaten are of the form 2&#8217;710&#8217;500 \/ 1&#8217;259&#8217;810. These use the Swiss coordinate system. pyproj is the defacto standard for doing coordinate processing, this page also helped. But I could make it work, those coordinate values were too big. Eventually I realised one &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/michaeltsmith.org.uk\/?p=66\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Remove first digit from Swiss Coordinates&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-66","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/posts\/66","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66"}],"version-history":[{"count":2,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions"}],"predecessor-version":[{"id":69,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=\/wp\/v2\/posts\/66\/revisions\/69"}],"wp:attachment":[{"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/michaeltsmith.org.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}