- Timestamp:
- Aug 10, 2010, 6:21:06 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nodes/make-map.py
r8296 r8302 60 60 def rd2etrs(xrd, yrd, hnap=0.0): 61 61 """ Convert rd to etrs """ 62 # Get cache is exists 62 63 global coordinates 63 xrd = float(str(xrd))64 yrd = float(str(yrd))65 64 if coordinates == None: 66 65 try: 67 66 coordinates = get_yaml(CACHE_FILE) 68 if coordinates.has_key((xrd, yrd)):69 return coordinates[(xrd, yrd)]70 67 except (IOError,AttributeError): 71 68 coordinates = dict() 72 69 pass 73 70 71 # Check if item in cache 72 xrd = float(str(xrd)) 73 yrd = float(str(yrd)) 74 if coordinates.has_key((xrd, yrd)): 75 return coordinates[(xrd, yrd)] 76 77 # Get new coordinate 74 78 item = dict() 75 79 item['xrd'] = xrd … … 79 83 args = "&".join(["%s=%s" % (k,v) for k,v in item.iteritems()]) 80 84 url = 'http://www.rdnap.nl/cgi-bin/rdetrs.pl?%s' % args 81 print "### Fetching coordinate %s, %s from %s" % (xrd, yrd, url)85 print "### Not in Cache, Fetching coordinate %s, %s from %s" % (xrd, yrd, url) 82 86 f = urllib.urlopen(url) 83 87 raw = f.read()
Note:
See TracChangeset
for help on using the changeset viewer.