- Timestamp:
- Apr 7, 2012, 11:25:44 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/rdnap.py
r10058 r10373 1 1 # 2 # REMEMBER2 # !!!REMEMBER!!! 3 3 # latitude : phi 4 4 # longitude : lam … … 33 33 pass 34 34 35 def etrs2rd(lam, phi): 36 """ Convert etrs to rd """ 35 def etrs2rd(phi, lam): 36 """ Convert etrs to rd coordinates 37 @Return: (X,Y) 38 """ 37 39 40 item['phi'] = phi 38 41 item['lam'] = lam 39 item['phi'] = phi40 42 item['func'] = 'etrs2rd' 41 url = 'http://vanderzwet.net/rdnap/%(func)s/%( xrd)s/%(yrd)s/0/' % item43 url = 'http://vanderzwet.net/rdnap/%(func)s/%(phi)s/%(lam)s/0/' % item 42 44 43 45 f = urllib.urlopen(url) … … 51 53 def rd2etrs(xrd, yrd, hnap=0.0): 52 54 """ 53 Convert rd to etrs 55 Convert rd to etrs 54 56 JavaScript Version: https://rdinfo.kadaster.nl/rd/transformator.html 57 @Return: (latitude,longitude) 55 58 """ 56 59 # Get cache is exists … … 76 79 item['func'] = 'rd2etrs' 77 80 url = 'http://vanderzwet.net/rdnap/%(func)s/%(xrd)s/%(yrd)s/%(hnap)s/' % item 78 print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url) 81 print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url) 79 82 f = urllib.urlopen(url) 80 83 raw = f.read() 81 82 # Coordinates returned in 'odd' order 84 83 85 phi,lam,h = raw.split('/') 84 coordinates[(xrd, yrd)] = ( lam, phi)86 coordinates[(xrd, yrd)] = (phi, lam) 85 87 write_yaml(CACHE_FILE, coordinates) 86 return ( lam, phi)88 return (phi, lam)
Note:
See TracChangeset
for help on using the changeset viewer.